persistent class %SYS.Task.History
extends %Persistent
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
parameter DOMAIN = "%Utility";
property DisplayErrorDate
as %Date [ Transient ];
property DisplayErrorNumber
as %String [ Transient ];
property DisplayFinished
as %String [ Transient ];
property DisplayStarted
as %String [ Transient ];
property DisplayStatus
as %String(MAXLEN=1024) [ Transient ];
property ER
as %String(MAXLEN=20);
$lb(date,index) in %ER global on error
property Error
as %String(MAXLEN=1024);
Untrapped error from User task, or "Success"
property ExecuteCode
as %String(MAXLEN=32000);
Code That was run
property LastFinished
as %String [ InitialExpression = 0 ];
$h Value of when the task was last finished
0 - Never finished
property LastStarted
as %String [ InitialExpression = 0 ];
$h Value of when the task was last started
0 - Never started
property LogDate
as %Date;
Date the log entry is made
property LogTime
as %Time;
Time the log entry is made
property Name
as %String(MAXLEN=32000);
Name of the task. Must be 16 characters or less, first character
must be a letter.
property NameSpace
as %String(MAXLEN=64) [ InitialExpression = "%SYS" ];
Namespace the task ran in
property RunningJobNumber
as %String;
$J value of the job which ran the task
property Status
as %CacheString [ InitialExpression = 0 ];
Value of Status if ExecuteCode is Set Status=
property Task
as %SYS.Task;
ID of Task
property Username
as %String;
method %OnBeforeSave(Insert As %Library.Boolean)
as %Status
This callback method is invoked by the %Save method to
provide notification that the object is being saved. It is called before
any data is written to disk.
insert will be set to 1 if this object is being saved for the first time.
If this method returns an error then the call to %Save will fail.
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.
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.
query DescendingTaskHistory(NULL)
Selects
Last Start As %String, Completed As %String, Task Name As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,Name,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Username,LogDate,LogTime
FROM %SYS_Task.History ORDER BY ID DESC
Returns all Task history in descending order.
query DescendingTaskHistoryDays(StartDate As %Date = +$H, EndDate As %Date = +$H)
Selects
Last Start As %String, Completed As %String, Task Name As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,Name,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Username,LogDate,LogTime
FROM %SYS_Task.History Where LogDate>=:StartDate and LogDate<=:EndDate ORDER BY ID DESC
query DescendingTaskHistoryForTask(Task As %Integer)
Selects
Last Start As %String, Completed As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Task Name As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Name,Username,LogDate,LogTime
FROM %SYS_Task.History
Where Task=:Task
ORDER BY ID DESC
query TaskHistory(NULL)
Selects
Last Start As %String, Completed As %String, Task Name As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,Name,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Username,LogDate,LogTime
FROM %SYS_Task.History
Returns a Task's history.
This query loops through the task history and returns information
concerning when the task was run
query TaskHistoryDetail(NULL)
Selects
Last Start As %String, Completed As %String, Task Name As %String, Status As %String, Result As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Task As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,Name,DisplayStatus,Error,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Task,Username,LogDate,LogTime
FROM %SYS_Task.History
query TaskHistoryForDay(StartDate As %Date = +$H, EndDate As %Date = +$H)
Selects
Last Start As %String, Completed As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Task Name As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Name,Username,LogDate,LogTime
FROM %SYS_Task.History
Where LogDate>=:StartDate and LogDate<=:EndDate
query TaskHistoryForTask(Task As %Integer)
Selects
Last Start As %String, Completed As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Task Name As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Name,Username,LogDate,LogTime
FROM %SYS_Task.History
Where Task=:Task
query TaskHistoryForTaskForDay(Task As %Integer, StartDate As %Date = +$H, EndDate As %Date = +$H)
Selects
Last Start As %String, Completed As %String, Status As %String, Result As %String, Task As %String, NameSpace As %String, Routine As %String, Pid As %String, %ER Date As %String, %ER Error # As %String, Task Name As %String, Username As %String, LogDate As %Date, LogTime As %Time
SQL Query
:
SELECT DisplayStarted,DisplayFinished,DisplayStatus,Error,Task,Namespace,ExecuteCode,RunningJobNumber,DisplayErrorDate,DisplayErrorNumber,Name,Username,LogDate,LogTime
FROM %SYS_Task.History
Where Task=:Task and LogDate>=:StartDate and LogDate<=:EndDate
index (LogDate on LogDate);
index (Task on Task);