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(*args, **kwargs)
The specific agents must provide the following methods:
initialize() for initial settings
execute() - the main method called in the agent cycle
- finalize() - the graceful exit of the method, this one is usually used
for the agent restart
- __init__(*args, **kwargs)
- 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.
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_secureCall(functor, args=(), name=False)
- am_setModuleParam(optionName, value)
- am_setOption(optionName, value)
- checkJob(job, classad)
This method controls the checking of the job, should be overridden in a subclass
The main agent execution method
- 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=None, logDB=None)
Initialization of the Optimizer Agent.
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.
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.