Class Reference
IRIS for UNIX 2019.2
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%SYS] >  [Task] >  [History]
Private  Storage   

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

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
1 20 7 10 2


Summary

Properties
DisplayErrorDate DisplayErrorNumber DisplayFinished DisplayLogDate
DisplayStarted DisplayStatus ER Error
ExecuteCode LastFinished LastStarted LogDate
LogTime Name NameSpace RunningJobNumber
Status Task Username

Methods
%AddToSaveSet %AddToSyncSet %BMEBuilt %CheckConstraints
%CheckConstraintsForExtent %ClassIsLatestVersion %ClassName %ComposeOid
%ConstructClone %Delete %DeleteExtent %DeleteId
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Exists
%ExistsId %Extends %GUID %GUIDSet
%GetLock %GetParameter %GetSwizzleObject %Id
%InsertBatch %IsA %IsModified %IsNull
%KillExtent %KillExtentData %LoadFromMemory %LockExtent
%LockId %New %NormalizeObject %ObjectIsNull
%ObjectModified %Oid %OnBeforeAddToSync %OnBeforeSave
%OnDetermineClass %Open %OpenId %OriginalNamespace
%PackageName %PhysicalAddress %PurgeIndices %Reload
%RemoveFromSaveSet %ResolveConcurrencyConflict %RollBack %Save
%SaveDirect %SaveIndices %SerializeObject %SetModified
%SortBegin %SortEnd %SyncObjectIn %SyncTransport
%UnlockExtent %UnlockId %ValidateIndices %ValidateObject
FormatTaskHistory PurgeHistory

Subclasses
%SYSTEM.TaskHistory

Parameters

• parameter DOMAIN = "%Utility";

Properties

• property DisplayErrorDate as %Date [ Transient ];
• property DisplayErrorNumber as %String [ Transient ];
• property DisplayFinished as %String [ Transient ];
• property DisplayLogDate as %String(MAXLEN=255) [ 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 %RawString [ InitialExpression = 0 ];
Value of Status if ExecuteCode is Set Status=
• property Task as %SYS.Task;
ID of Task
• property Username as %String;

Methods

• 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.

Queries

• 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,DisplayLogDate,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,DisplayLogDate,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,DisplayLogDate,LogTime
FROM %SYS_Task.History
Where Task=:Task
ORDER BY ID DESC
• query DescendingTaskHistoryUser(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,DisplayLogDate,LogTime
FROM %SYS_Task.History
WHERE Task->Type = 2 -- Type 0 is System tasks, Type 1 is Maintenance tasks, Type 2 is User tasks. Type 0 and 1 are reserved for System Tasks
ORDER BY ID DESC
Returns all non-system Task history in descending order.
• 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,DisplayLogDate,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,DisplayLogDate,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,DisplayLogDate,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,DisplayLogDate,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,DisplayLogDate,LogTime
FROM %SYS_Task.History
Where Task=:Task and LogDate>=:StartDate and LogDate<=:EndDate

Indices

•index (LogDate on LogDate);
•index (Task on Task);


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.