def main():
    global ceName
    global Site
    global Queue
    Script.registerSwitch("N:", "Name=", "Computing Element Name (Mandatory)",
                          setCEName)
    Script.registerSwitch("S:", "Site=", "Site Name (Mandatory)", setSite)
    Script.registerSwitch("Q:", "Queue=", "Queue Name (Mandatory)", setQueue)
    Script.parseCommandLine(ignoreErrors=True)

    gLogger.info("Getting number of processors")
    numberOfProcessor = JobParameters.getNumberOfProcessors(
        Site, ceName, Queue)

    gLogger.info("Getting memory (RAM) from MJF")
    maxRAM = JobParameters.getMemoryFromMJF()
    if not maxRAM:
        gLogger.info(
            "maxRAM could not be found in MJF, using JobParameters.getMemoryFromProc()"
        )
        maxRAM = JobParameters.getMemoryFromProc()

    gLogger.info("Getting number of GPUs")
    numberOfGPUs = JobParameters.getNumberOfGPUs(Site, ceName, Queue)

    # just communicating it back
    gLogger.notice(" ".join(
        str(wnPar) for wnPar in [numberOfProcessor, maxRAM, numberOfGPUs]))
def setCEName( args ):
  global ceName
  ceName = args

def setSite( args ):
  global Site
  Site = args

def setQueue( args ):
  global Queue
  Queue = args

Script.registerSwitch( "N:", "Name=", "Computing Element Name (Mandatory)", setCEName )
Script.registerSwitch( "S:", "Site=", "Site Name (Mandatory)", setSite )
Script.registerSwitch( "Q:", "Queue=", "Queue Name (Mandatory)", setQueue )
Script.parseCommandLine( ignoreErrors = True )

grid = Site.split( '.' )[0]
numberOfProcessor = JobParameters.getProcessorFromMJF()
if not numberOfProcessor:
  numberOfProcessor = gConfig.getValue( '/Resources/Sites/%s/%s/CEs/%s/Queues/%s/NumberOfProcessors' % ( grid, Site, ceName, Queue ) )
  if not numberOfProcessor:
    numberOfProcessor = gConfig.getValue( '/Resources/Sites/%s/NumberOfProcessors' % grid )
    if not numberOfProcessor:
      numberOfProcessor = Os.getNumberOfCores()
  
maxRAM = JobParameters.getMemoryFromMJF()
if not maxRAM:
  maxRAM = JobParameters.getMemoryFromProc()
gLogger.notice( numberOfProcessor, maxRAM )
Beispiel #3
0
def setSite(args):
    global Site
    Site = args


def setQueue(args):
    global Queue
    Queue = args


Script.registerSwitch("N:", "Name=", "Computing Element Name (Mandatory)",
                      setCEName)
Script.registerSwitch("S:", "Site=", "Site Name (Mandatory)", setSite)
Script.registerSwitch("Q:", "Queue=", "Queue Name (Mandatory)", setQueue)
Script.parseCommandLine(ignoreErrors=True)

gLogger.info("Getting number of processors")
numberOfProcessor = JobParameters.getNumberOfProcessors(Site, ceName, Queue)

gLogger.info("Getting memory (RAM) from MJF")
maxRAM = JobParameters.getMemoryFromMJF()
if not maxRAM:
    gLogger.info(
        "maxRAM could not be found in MJF, using JobParameters.getMemoryFromProc()"
    )
    maxRAM = JobParameters.getMemoryFromProc()

# just communicating it back
gLogger.notice(numberOfProcessor, maxRAM)