OptimizerModule

The Optimizer base class is an agent that polls for jobs with a specific status and minor status pair. The checkJob method is overridden for all optimizer instances and associated actions are performed there.

class DIRAC.WorkloadManagementSystem.Agent.OptimizerModule.OptimizerModule(agentName, loadName, baseAgentName=False, properties={})

Bases: DIRAC.Core.Base.AgentModule.AgentModule

The specific agents must provide the following methods:

  • initialize() for initial settings
  • beginExecution()
  • execute() - the main method called in the agent cycle
  • endExecution()
  • finalize() - the graceful exit of the method, this one is usually used
    for the agent restart
am_Enabled()
am_checkStopAgentFile()
am_createStopAgentFile()
am_disableMonitoring()
am_getBasePath()
am_getControlDirectory()
am_getCyclesDone()
am_getMaxCycles()
am_getModuleParam(optionName)
am_getOption(optionName, defaultValue=None)
am_getPollingTime()
am_getShifterProxyLocation()
am_getStopAgentFile()
am_getWatchdogTime()
am_getWorkDirectory()
am_go()
am_initialize(*initArgs)
am_monitoringEnabled()
am_removeStopAgentFile()
am_secureCall(functor, args=(), name=False)
am_setModuleParam(optionName, value)
am_setOption(optionName, value)
am_stopExecution()
beginExecution()
checkJob(job, classad)

This method controls the checking of the job, should be overridden in a subclass

endExecution()
execute()

The main agent execution method

finalize()
getJobDefinition(job, jobDef=False)

Retrieve JDL of the Job and return jobDef dictionary

getOptimizerJobInfo(job, reportName)

This method gets job optimizer information that will be used for

initialize(jobDB=False, logDB=False)

Initialization of the Optimizer Agent.

initializeOptimizer()

To be overwritten by inheriting class

optimizeJob(job, classAdJob)

Call the corresponding Optimizer checkJob method

sendAccountingRecord(job, msg, classAdJob)

Send and accounting record for the failed job

setFailedJob(job, msg, classAdJob=None)

This method moves the job to the failed status

setJobParam(job, reportName, value)

This method updates a job parameter in the JobDB.

setNextOptimizer(job)

This method is executed when the optimizer instance has successfully processed the job. The next optimizer in the chain will subsequently start to work on the job.

setOptimizerChain(job, value)

This method sets the job optimizer chain, in principle only needed by one of the optimizers.

setOptimizerJobInfo(job, reportName, value)

This method sets the job optimizer information that will subsequently be used for job scheduling and TURL queries on the WN.

updateJobStatus(job, status, minorStatus=None, appStatus=None)

This method updates the job status in the JobDB, this should only be used to fail jobs due to the optimizer chain.