TaskManagerAgentBase

NOTA BENE: This agent should NOT be run alone. Instead, it serves as a base class for extensions.

The TaskManagerAgentBase is the base class to submit tasks to external systems, monitor and update the tasks and file status in the transformation DB.

This agent is extended in WorkflowTaskAgent and RequestTaskAgent. In case you want to further extend it you are required to follow the note on the initialize method and on the _getClients method.

class DIRAC.TransformationSystem.Agent.TaskManagerAgentBase.TaskManagerAgentBase(*args, **kwargs)

Bases: AgentModule, TransformationAgentsUtilities

To be extended. Please look at WorkflowTaskAgent and RequestTaskAgent.

__init__(*args, **kwargs)

c’tor

Always call this in the extension agent

am_Enabled()
am_checkStopAgentFile()
am_createStopAgentFile()
am_getControlDirectory()
am_getCyclesDone()
am_getMaxCycles()
am_getModuleParam(optionName)
am_getOption(optionName, defaultValue=None)

Gets an option from the agent’s configuration section. The section will be a subsection of the /Systems section in the CS.

am_getPollingTime()
am_getShifterProxyLocation()
am_getStopAgentFile()
am_getWatchdogTime()
am_getWorkDirectory()
am_go()
am_initialize(*initArgs)

Common initialization for all the agents.

This is executed every time an agent (re)starts. This is called by the AgentReactor, should not be overridden.

am_removeStopAgentFile()
am_secureCall(functor, args=(), name=False)
am_setModuleParam(optionName, value)
am_setOption(optionName, value)
am_stopExecution()
beginExecution()
checkReservedTasks(transDict, clients)

Checking Reserved tasks

endExecution()
execute()

The execution method is transformations that need to be processed

finalize()

graceful finalization

initialize()

Agent initialization.

The extensions MUST provide in the initialize method the following data members: - TransformationClient objects (self.transClient), - set the shifterProxy if different from the default one set here (‘ProductionManager’) - list of transformation types to be looked (self.transType)

submitTasks(transDict, clients)

Submit the tasks to an external system, using the taskManager provided

Parameters:
  • transIDOPBody (dict) – transformation body

  • clients (dict) – dictionary of client objects

Returns:

S_OK/S_ERROR

updateFileStatus(transDict, clients)

Update the files status

updateTaskStatus(transDict, clients)

Updates the task status