class %DeepSee.WorkMgr extends %RegisteredObject
Utility class that provides an API for managing
This is an internal utility used by DeepSee.
parameter EVENTNAME = "^DeepSee.Tasks.";
Name of system used to talk to agents.parameter TIMEOUT = 0;
Timeout value (seconds) for events. If no events are received, then the agent will shut itself down.
classmethod %AgentsAvailable(pPriority="H", Output pStatus) as %Integer
- NOT IMPLEMENTED - Agents are always available and created as needed. There is no need to test anymore.classmethod %AttachToQueue(pQueueName As %String = "", Output pStatus As %Status = $$$OK) as %SYSTEM.WorkMgr
Look up a token to reattach to a given WorkMgr queue. After successfully serializing a WorkMgr instance, through either attachment to a pre-existing queue or initialization of a new queue, the storage location for the provided pQueueName is marked with the null string to provide an indication the queue is currently open and working.classmethod %BestQueue(pTaskGroup)
Determine which work queue a task should be assigned to.classmethod %CleanAgentsGlobal() as %Status
- NOT IMPLEMENTED - The agents global is no longer used.classmethod %CloseTask(pTaskGroup As %String, pParameters As %List) as %Status
This is called as the callback to %ExecuteTask which cleans up the management global. This method will also close out the WorkQ if the group was create with pWait = 0.classmethod %CreateAgents(pNumAgents As %Integer = "") as %Status
- NOT IMPLEMENTED - This is handled by the WorkQMgr as part of task queueing operationsclassmethod %CreateTaskGroup(Output pTaskGroup As %String, pWait As %Boolean = 0, pName As %String = "", pRequestWorkMgr=0, Output pWorkMgr=$$$NULLOREF) as %Status
Create a unique idenitfier for a task group. The caller may optionally request an object reference with pRequestWorkMgr=1 which will be returned via pWorkMgr for customized use.classmethod %DequeueTask(pTaskGroup As %String, pParameters As %List, pSuppressArchive As %Boolean = 0) as %Status
This is called in %ExecuteTask to mark the task "active" in the process logging.classmethod %DestroyTaskGroup(pTaskGroup As %String = "", pPurgeTasks As %Boolean = 1) as %Status
Close down all work being done by this task groupclassmethod %DetachFromQueue(pQueueName As %String = "", ByRef pWorkMgr As %SYSTEM.WorkMgr = $$$NULLOREF) as %Status
Detach from a given WorkMgr queue and store the current token needed to reattach. If the storage location has been deleted before detaching from the queue (eg: by a cancellation operation), then the token is discarded.classmethod %ExecuteTask(pTaskGroup As %String, pParameters As %List, pSuppressArchive As %Boolean = 0) as %Status
This is run by the worker and will do the actual work of processing tasks via the work queue managerclassmethod %InitializeWorkMgr(pQueueName, ByRef pStatus) as %SYSTEM.WorkMgr
Create a new %SYSTEM.WorkMgr instance for use managing this DeepSee task queue.classmethod %IsActive() as %Boolean
WorkQ agents will be made available as needed. This test always returns Trueclassmethod %KillAgents(pPurgeTasks As %Boolean = 0) as %Status
Find all open WorkQ manager instances and shut them downclassmethod %KillLog(pMsg As %String) as %Status
Kill the agent log.classmethod %KillTasksForGroup(pTaskGroup As %String) as %Status
This performs the actual cleanup work to remove all tasks assigned to a particular logical work group.classmethod %Log(pMsg As %String)
Log a message to the agent log.classmethod %PrintActiveTasks()
Print list of active tasks out to the console.classmethod %PrintAgents()
Print list of agents out to the console.classmethod %PrintLog()
Print contents of the (global-based) agent log to the console.classmethod %PrintPendingTasks()
Print list of pending (queued) tasks out to the console.classmethod %PrintTaskGroups()
Print current task groups to the console.classmethod %QueueTask(pTaskGroup As %String = "", pTaskType As %String, pCubeName As %String, pQueryKey As %String = "", pData As %String = "", pData2 As %String = "", pData3 As %String = "", pSQLParams As %String = "", pSuppressArchive As %Boolean = 0, ByRef pWorkMgr As %SYSTEM.WorkMgr = $$$NULLOREF) as %Status
This is called from the foreground to add a task to the queue of background tasks.classmethod %Reset() as %Status
pTaskGroup must be defined in order to properly assign individual tasks to a particular work queue. The caller may optionally supply an object reference to a pWorkMgr to add the task to that custom work queue.
Reset the WorkMgr.classmethod %SetLoggingOptions(pUseArchive=0, pLogSize=100, pLogAll=0)
This stops all running agents, clears out all tasks, and clears the logs.
Turn on logging for the DeepSee background agents. These will be reset during a call to %KillLog.classmethod %Test(pTaskCount=25, pTimeOut=0, pClean=1) as %Status
Perform simple test of DeepSee WorkMgr. This will kill any pending task.classmethod %WaitForTaskGroup(ByRef pTaskGroup As %String = "", Output pCompleted As %Boolean, pTimeOut As %Integer = 0, ByRef pWorkMgr As %SYSTEM.WorkMgr = $$$NULLOREF) as %Status
Wrapper for the WorkMgr:WaitForComplete() that parallels the original %DeepSee.TaskMaster version. The caller may optionally supply an object reference to a pWorkMgr for custom use.