pilotTools

A set of common tools to be used in pilot commands

class DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.CommandBase(pilotParams, dummy='')

Bases: object

CommandBase is the base class for every command in the pilot commands toolbox

__init__(pilotParams, dummy='')

c’tor

Defines the logger and the pilot parameters

executeAndGetOutput(cmd, environDict=None)

Execute a command on the worker node and get the output

exitWithError(errorCode)

Wrapper around sys.exit()

class DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.Logger(name='Pilot', debugFlag=False, pilotOutput='pilot.out')

Bases: object

Basic logger object, for use inside the pilot. Just using print.

__init__(name='Pilot', debugFlag=False, pilotOutput='pilot.out')

x.__init__(…) initializes x; see help(type(x)) for signature

debug(msg, header=True)
error(msg, header=True)
info(msg, header=True)
setDebug()
warn(msg, header=True)
class DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.ObjectLoader(baseModules, log)

Bases: object

Simplified class for loading objects from a DIRAC installation.

Example:

ol = ObjectLoader() object, modulePath = ol.loadObject( ‘pilot’, ‘LaunchAgent’ )

__init__(baseModules, log)

init

loadModule(modName, hideExceptions=False)

Auto search which root module has to be used

loadObject(package, moduleName, command)

Load an object from inside a module

class DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.PilotParams

Bases: object

Class that holds the structure with all the parameters to be used across all the commands

MAX_CYCLES = 10
__init__()

c’tor

param names and defaults are defined here

DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.alarmTimeoutHandler(*args)
DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.getCommand(params, commandName, log)

Get an instantiated command object for execution. Commands are looked in the following modules in the order:

  1. <CommandExtension>Commands
  2. pilotCommands
  3. <Extension>.WorkloadManagementSystem.PilotAgent.<CommandExtension>Commands
  4. <Extension>.WorkloadManagementSystem.PilotAgent.pilotCommands
  5. DIRAC.WorkloadManagementSystem.PilotAgent.<CommandExtension>Commands
  6. DIRAC.WorkloadManagementSystem.PilotAgent.pilotCommands

Note that commands in 3.-6. can only be used of the the DIRAC installation has been done. DIRAC extensions are taken from -e ( –extraPackages ) option of the pilot script.

DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.printVersion(log)
DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.pythonPathCheck()
DIRAC.WorkloadManagementSystem.PilotAgent.pilotTools.retrieveUrlTimeout(url, fileName, log, timeout=0)

Retrieve remote url to local file, with timeout wrapper