The TimeLeft utility allows to calculate the amount of CPU time left for a given batch system slot. This is essential for the ‘Filling Mode’ where several VO jobs may be executed in the same allocated slot.

The prerequisites for the utility to run are:
  • Plugin for extracting information from local batch system
  • Scale factor for the local site.

With this information the utility can calculate in normalized units the CPU time remaining for a given slot.

class DIRAC.Core.Utilities.TimeLeft.TimeLeft.TimeLeft

Bases: object

This generally does not run alone


Standard constructor


Returns the current CPU Time spend (according to batch system) scaled according to /LocalSite/CPUScalingFactor

getTimeLeft(cpuConsumed=0.0, processors=1)

Returns the CPU Time Left for supported batch systems. The CPUConsumed is the current raw total CPU.

DIRAC.Core.Utilities.TimeLeft.TimeLeft.enoughTimeLeft(cpu, cpuLimit, wallClock, wallClockLimit, cpuMargin, wallClockMargin)

Is there enough time?

DIRAC.Core.Utilities.TimeLeft.TimeLeft.runCommand(cmd, timeout=120)

Wrapper around shellCall to return S_OK(stdout) or S_ERROR(message)