Skip to main content

%SYS.Task.History

Class %SYS.Task.History Extends %Persistent [ System = 4 ]

Used to track events in the TASKMGR environment When jobs are completed Deletion of tasks Updates to Configuration data Starting of the TASKMGR Suspending/Resuming Tasks or TASKMGR

Parameters

DOMAIN

Parameter DOMAIN = "%Utility";

Properties

LogDate

Property LogDate As %Date;

Date the log entry is made

LogTime

Property LogTime As %Time;

Time the log entry is made

Status

Property Status As %RawString [ InitialExpression = 0 ];

Value of Status if ExecuteCode is Set Status=

ExecuteCode

Property ExecuteCode As %String(MAXLEN = 32000);

Code That was run

LastStarted

Property LastStarted As %String [ InitialExpression = 0 ];

$h Value of when the task was last started
0 - Never started

LastFinished

Property LastFinished As %String [ InitialExpression = 0 ];

$h Value of when the task was last finished
0 - Never finished

Name

Property Name As %String(MAXLEN = 32000);

Name of the task. Must be 16 characters or less, first character must be a letter.

Number

Property Number As %Integer [ InitialExpression = 0, Internal ];

Calculated by the system

NameSpace

Property NameSpace As %String(MAXLEN = 64) [ InitialExpression = "%SYS" ];

Namespace the task ran in

ER

Property ER As %String(MAXLEN = 20);

$lb(date,index) in %ER global on error

Error

Property Error As %String(MAXLEN = 1024);

Untrapped error from User task, or "Success"

RunningJobNumber

Property RunningJobNumber As %String;

$J value of the job which ran the task

Task

Property Task As %SYS.Task;

ID of Task

DisplayStarted

Property DisplayStarted As %String [ SqlComputeCode = { Set {DisplayStarted}=$s({LastStarted}=0:"",1:$zdatetime({LastStarted},3,2))}, SqlComputed, Transient ];

DisplayFinished

Property DisplayFinished As %String [ SqlComputeCode = { Set {DisplayFinished}=$s({LastFinished}=0:"",1:$zdatetime({LastFinished},3,2))}, SqlComputed, Transient ];

DisplayStatus

Property DisplayStatus As %String(MAXLEN = 1024) [ SqlComputeCode = {	Set {DisplayStatus}=$s({Status}=1:1,{Status}=0:"",1:$system.Status.GetErrorText({Status}))}, SqlComputed, Transient ];

DisplayErrorDate

Property DisplayErrorDate As %Date [ SqlComputeCode = { Set {DisplayErrorDate}=$s({ER}="":"",1:$lg({ER}))}, SqlComputed, Transient ];

DisplayErrorNumber

Property DisplayErrorNumber As %String [ SqlComputeCode = {	Set {DisplayErrorNumber}=$s({ER}="":"",1:$lg({ER},2))}, SqlComputed, Transient ];

DisplayLogDate

Property DisplayLogDate As %String(MAXLEN = 255) [ SqlComputeCode = { Set {DisplayLogDate}=$s({LogDate}=0:"",1:$zdate({LogDate},3))}, SqlComputed, Transient ];

Username

Property Username As %Library.Username;

Methods

%OnBeforeSave

Method %OnBeforeSave(Insert As %Library.Boolean) As %Status

PurgeHistory

ClassMethod PurgeHistory(days As %Integer) As %Status

Purge Task History. This method purges the task history. It will retain Task history for the number of days set by the $SYS.Task.HistoryPurgeSet class method.

FormatTaskHistory

ClassMethod FormatTaskHistory(LastStarted As %String, Completed As %String, Name As %String, Status As %String, Result As %String) As %String

Formats a line for the TaskHistory query.

WriteLog

ClassMethod WriteLog(Status As %Integer, Error As %String, LastStarted As %String, LastFinished As %String, Name As %String, Number As %String, NameSpace As %String, ExecuteCode As %String = "", ER As %String = "", Task As %Integer = "", PID As %String) As %Status [ Internal ]

Write an entry to the history log based on the passed values

DescendingTaskHistoryFilterExecute

ClassMethod DescendingTaskHistoryFilterExecute(ByRef qHandle As %Binary, Filter As %String = "", UserOnly As %Boolean = 0) As %Status [ Internal ]

Returns a Task's history.
This query loops through the task history and returns information concerning when the task was run Returns all Task history in descending order. Returns all non-system Task history in descending order.

DescendingTaskHistoryFilterFetch

ClassMethod DescendingTaskHistoryFilterFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ Internal, PlaceAfter = DescendingTaskHistoryFilterExecute ]

DescendingTaskHistoryFilterClose

ClassMethod DescendingTaskHistoryFilterClose(ByRef qHandle As %Binary) As %Status [ Internal, PlaceAfter = DescendingTaskHistoryFilterExecute ]