This class implements a framework for providing administrators with status and control
of long-running tasks/utilities/operations that set to run in the background. These
are typically (but not necessarily) tasks that are started interactively, but run in
the background because they may run for a long time (e.g. some database management
utilities). Note that this framework is separate from the "Task Manager" frameword
which can be used to schedule activity.
There are subclasses for each type of operation that uses this infrastructure and
objects of those subclasses represent instances that are running or have run since
the system started up.
To use this framework for progress and control of a background task, you simply
open or query objects the objects through this class or the relevant subclass.
The properties represent a snapshot of the state and progress of the task.
You can periodically check for changes by rerunning the query or reloading the object
via standard object interfaces %OpenId() and %Reload().
RunningState contains information about whether the task is
running or not (as of the time the object was last loaded or queried).
Progress information may be available via ProgressCurrent,
ProgressTotal and ProgressUnits. When complete,
the %Status is available in FinalStatus. Subclasses may expose
other properties that are germain to that particular type of operation.
Users should not modify properties or save these objects.
To start a job running the task in the background, you can use class method
Start() in the desired subclass. The arguments are unique to each
subclass. Start() returns an oref to use for monitor and control.
0 - not allowed
1 - polls for cancel requests
-1 - directly terminate the process
parameter DOMAIN = %Utility;
parameter PAUSEDISPOSITION = 0;
Disposition for pause requests.
0 - not allowed
1 - polls for pause requests
-1 - directly pause the process
Properties
property CancelIsAvailable as %Integer [ Calculated ];
True if cancel is allowed for this task and the state (as of load time)
is such that it can be paused. Used by user interface code to determine
whether to enable a "cancel" control.
property PauseIsAvailable as %Integer [ Calculated ];
True if pause is allowed for this task and the state (as of load time)
is such that it can be paused. Used by user interface code to determine
whether to enable a "pause" control.
property ProgressTotal as %Numeric [ Calculated ];
The total amount of progress that must be made to complete. This value may
change while running as more accurate estimates become available.
See ProgressCurrent for more detail.
The units in which progress is measured. Used to display progress to the
user. Null is allowed, treating progress as dimensionless.
See ProgressCurrent for more details.
Starts this task in the background and returns on oref for monitoring and control.
Returns null on error, with error status available in %objlasterror.
The meaning of the arguments are specific to each subclass.
Queries
query DatabaseList()
SQL Query: SELECT ID,StartTime,DisplayType,Database,RunningState,HasEnded,ProgressTotal,ProgressCurrent
FROM SYS_Database.BackgroundFileCompact
UNION
SELECT ID,StartTime,DisplayType,Database,RunningState,HasEnded,ProgressTotal,ProgressCurrent
FROM SYS_Database.BackgroundDefragment
ORDER BY ID
All database-oriented tasks. This currently includes SYS.Database.BackgroundFileCompact and SYS.Database.BackgroundFileCompact
query ListAll()
SQL Query: SELECT %ID,StartTime,Class,DisplayType,Namespace,RunningState,HasEnded,FinalStatus,
ProgressCurrent,ProgressTotal,ProgressUnits
FROM %SYS.BackgroundTask
Query background tasks of all types
Indexes
index (IDKEY on ) [IdKey, Type = key];
Index methods: IDKEYCheck(), IDKEYDelete(), IDKEYExists(), IDKEYOpen(), IDKEYSQLCheckUnique(), IDKEYSQLExists(), IDKEYSQLFindPKeyByConstraint(), IDKEYSQLFindRowIDByConstraint()