Class Reference
IRIS for UNIX 2019.4
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%DeepSee] >  [WorkMgr]
Private  Storage   

class %DeepSee.WorkMgr extends %RegisteredObject

Utility class that provides an API for managing DeepSee tasks.
This is an internal utility used by DeepSee.


Parameters Properties Methods Queries Indices ForeignKeys Triggers
2 31


%%OIDGet %AddToSaveSet %AgentsAvailable %AttachToQueue
%BestQueue %BindExport %BuildObjectGraph %ClassIsLatestVersion
%ClassName %CleanAgentsGlobal %Close %CloseTask
%ConstructClone %CountLiveAgents %CreateAgents %CreateTaskGroup
%DequeueTask %DestroyTaskGroup %DetachFromQueue %DispatchClassMethod
%DispatchGetModified %DispatchGetProperty %DispatchMethod %DispatchSetModified
%DispatchSetMultidimProperty %DispatchSetProperty %ExecuteTask %Extends
%GetParameter %IncrementCount %IsA %IsActive
%IsModified %KillAgents %KillLog %KillTasksForGroup
%Log %New %NormalizeObject %ObjectModified
%OriginalNamespace %PackageName %PrintActiveTasks %PrintAgents
%PrintLog %PrintPendingTasks %PrintTaskGroups %QueueArchivedTask
%QueueTask %RemoveFromSaveSet %Reset %RunArchivedTask
%RunArchivedTaskGroup %SerializeObject %SetLoggingOptions %SetModified
%StartAgent %Test %ValidateObject %WaitForTaskGroup


• 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 %CountLiveAgents(pPriority="H", Output pStatus, pCleanDeadAgents=0) as %Integer
- NOT IMPLEMENTED - There is no longer direct management of agents by this class.
• classmethod %CreateAgents(pNumAgents As %Integer = "") as %Status
- NOT IMPLEMENTED - This is handled by the WorkQMgr as part of task queueing operations
• classmethod %CreateTaskGroup(Output pTaskGroup As %String, pWait As %Boolean = 0, pName As %String = "") as %Status
Initialization of a %SYSTEM.WorkMgr instance.
• 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 group
• classmethod %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 manager
• classmethod %IsActive() as %Boolean
WorkQ agents will be made available as needed. This test always returns True
• classmethod %KillAgents(pPurgeTasks As %Boolean = 0) as %Status
Find all open WorkQ manager instances and shut them down
• classmethod %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 %QueueArchivedTask(pTaskId As %Integer, pTaskGroup As %String = "", pVerbose As %Boolean = 1, pSuppressArchive As %Boolean = 1) as %Status
Diagnostic method to dispatch an archived task to a DeepSee background agent. Several tasks can be grouped into a single batch of archived tasks by supplying a pTaskGroup. If pSuppressArchive = 1, the re-execution of an archived task will not get archived.
• 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) as %Status
This is called from the foreground to add a task to the queue of background tasks.
pTaskGroup must be defined in order to properly assign individual tasks to a particular work queue.
• classmethod %Reset() as %Status
Reset the WorkMgr.
This stops all running agents, clears out all tasks, and clears the logs.
• classmethod %RunArchivedTask(pTaskId As %Integer, pVerbose As %Boolean = 1) as %Status
Diagnostic method.
• classmethod %RunArchivedTaskGroup(pTaskStartId As %Integer = 1, pTaskEndId As %String = 0, pAsync As %Boolean = 1, pSuppressArchive As %Boolean = 1, pWaitTimeout As %Integer = 30, pVerbose As %Boolean = 1) as %Status
This is a diagnostic utility which will run a group of tasks from the task archive. Siunce the task archive is a ring buffer, pTaskEndId may be set to 0 to indicate that the method should run to the end of the log. By default the method will re-queue the entire task archive beginning at position #1 for processing by DeepSee background agents. When using background processing, if pSuppressArchive = 1, then the re-execution of an archived task will not get archived.
The method can be switched to execute each task sequentially in the foreground by setting pAsync=0.
• classmethod %SetLoggingOptions(pUseArchive=0, pLogSize=100, pLogAll=0)
Turn on logging for the DeepSee background agents. These will be reset during a call to %KillLog.
• classmethod %StartAgent(pAgentId As %String, pPriority As %String)
- NOT IMPLEMENTED - This is handled by the WorkQMgr.
• 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) as %Status
Wrapper for the WorkQMgr:WaitForComplete() that parallels the original %DeepSee.TaskMaster version.

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