예제 #1
0
# dirac job created by ganga
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from LHCbDIRAC.Interfaces.API.LHCbJob import LHCbJob
from LHCbDIRAC.Interfaces.API.DiracLHCb import DiracLHCb
j = LHCbJob()
dirac = DiracLHCb()

# default commands added by ganga
j.setName("helloWorld-test")
j.setInputSandbox([
    '/afs/cern.ch/user/f/fstagni/userJobs/_inputHello.tgz',
    '/afs/cern.ch/user/f/fstagni/userJobs/hello-script.py'
])

j.setExecutable("exe-script.py", "", "Ganga_Executable.log")

# <-- user settings
j.setCPUTime(172800)
try:
    tier1s = DMSHelpers().getTiers(tier=(0, 1))
except AttributeError:
    tier1s = [
        'LCG.CERN.cern', 'LCG.CNAF.it', 'LCG.GRIDKA.de', 'LCG.IN2P3.fr',
        'LCG.NIKHEF.nl', 'LCG.PIC.es', 'LCG.RAL.uk', 'LCG.RRCKI.ru',
        'LCG.SARA.nl'
    ]
j.setBannedSites(tier1s)
# user settings -->

# print j.workflow
예제 #2
0
#for i in range(1,2):
#for i in range(1,2):
  inputList = [workdir+'gammaDh']
#               "CLEO_K3PiScan_2014_pdf.root",
#               "CLEO_K3PiScan_2009_GaussianRise_pdf2.root",
#               "CLEO_KPiPi0Scan_2014_pdf.root",
#               "CLEO_KSKpiScan_2012_Kst_pdf.root"]

#  arg = "tot 1500000000 1";
  arg = "tot 500000000 1";



  j1 = LHCbJob()
  j1.setName('GammaDh.'+mode+'.'+str(i))
  j1.setExecutable('run_gamma_Dh.sh',arg,'gamma.log')
  j1.setInputSandbox(inputList)
  j1.setOutputSandbox(['*.root','__postprocesslocations__','std.out','std.err','*.log'])
  j1.setOutputData(['*.root'])
  j1.setCPUTime(172800)
  j1.setBannedSites(['LCG.CERN.ch', 'LCG.CNAF.it', 'LCG.GRIDKA.de', 'LCG.IN2P3.fr', 'LCG.NIKHEF.nl', 'LCG.PIC.es', 'LCG.RAL.uk', 'LCG.SARA.nl'])
 
  jobList.append({ 'Job' : j1, 'Name' : 'GammaDh.'+mode+'.'+str(i) })
  

#SPLITTING JOBLIST BY THREAD
nThread = int(10)
if len(jobList) < nThread: nThread = len(jobList)

njobsPerList = len(jobList)/nThread #Number of jobs to submit for each thread
예제 #3
0
gLogger.setLevel('DEBUG')

cwd = os.path.realpath('.')

dirac = DiracLHCb()

# Simple Hello Word job to DIRAC.Jenkins.ch
gLogger.info("\n Submitting hello world job targeting DIRAC.Jenkins.ch")
helloJ = LHCbJob()
helloJ.setName("helloWorld-TEST-TO-Jenkins")
try:
  helloJ.setInputSandbox([find_all('exe-script.py', rootPath, '/DIRAC/tests/Workflow/')[0]])
except IndexError:
  helloJ.setInputSandbox([find_all('exe-script.py', os.environ['WORKSPACE'], '/DIRAC/tests/Workflow/')[0]])
helloJ.setExecutable("exe-script.py", "", "helloWorld.log")
helloJ.setCPUTime(17800)
helloJ.setDestination('DIRAC.Jenkins.ch')
result = dirac.submitJob(helloJ)
gLogger.info("Hello world job: ", result)
if not result['OK']:
  gLogger.error("Problem submitting job", result['Message'])
  exit(1)


# Simple Hello Word job to DIRAC.Jenkins.ch, with an input file
gLogger.info("\n Submitting hello world job, with input, targeting DIRAC.Jenkins.ch")
inputJ = LHCbJob()
inputJ.setName("helloWorld-TEST-INPUT-TO-Jenkins")
try:
  inputJ.setInputSandbox([find_all('exe-script-with-input-jenkins.py',
parseCommandLine()

from DIRAC.tests.Utilities.utils import find_all
from LHCbDIRAC.Interfaces.API.LHCbJob import LHCbJob


# With a script that returns 0
try:
  scriptSHLocation = find_all('script-OK.sh', rootPath,
                              '/DIRAC/WorkloadManagementSystem/JobWrapper')[0]
except IndexError:  # we are in Jenkins
  scriptSHLocation = find_all('exe-script.py', os.environ['WORKSPACE'],
                              '/DIRAC/WorkloadManagementSystem/JobWrapper')[0]

j = LHCbJob()
j.setExecutable('sh %s' % scriptSHLocation, modulesNameList=['LHCbScript'])
jobXMLFile = 'jobDescriptionLHCb-OK.xml'
with open(jobXMLFile, 'w+') as fd:
  fd.write(j._toXML())

# # With a script that returns 0 - multiple steps
j = LHCbJob()
j.setExecutable('sh %s' % scriptSHLocation, modulesNameList=['LHCbScript', 'CreateDataFile'])
jobXMLFile = 'jobDescriptionLHCb-multiSteps-OK.xml'
with open(jobXMLFile, 'w+') as fd:
  fd.write(j._toXML())


# # With a script that returns 111
try:
  scriptSHLocation = find_all('script.sh', rootPath,
    def test_LHCbsubmit(self):

        print "**********************************************************************************************************"

        gLogger.info(
            "\n Submitting hello world job targeting DIRAC.JobDebugger.cern")

        helloJ = LHCbJob()

        helloJ.setName("helloWorld-test-CERN")
        helloJ.setInputSandbox([
            find_all('exe-script.py', '..',
                     '/LHCbDIRAC/tests/System/GridTestSubmission')[0]
        ])
        helloJ.setExecutable("exe-script.py", "", "helloWorld.log")

        helloJ.setCPUTime(17800)
        helloJ.setDestination('DIRAC.JobDebugger.cern')
        result = self.dirac.submitJob(helloJ)
        gLogger.info("Hello world job: ", result)
        jobID = int(result['Value'])
        jobsSubmittedList.append(jobID)

        self.assertTrue(result['OK'])

        print "**********************************************************************************************************"

        gLogger.info("\n Submitting hello world job targeting slc6 machines")

        helloJ = LHCbJob()

        helloJ.setName("helloWorld-test-slc6")
        helloJ.setInputSandbox([
            find_all('exe-script.py', '.',
                     '/LHCbDIRAC/tests/System/GridTestSubmission')[0]
        ])
        helloJ.setExecutable("exe-script.py", "", "helloWorld.log")

        helloJ.setCPUTime(17800)
        helloJ.setPlatform('x86_64-slc6')
        result = self.dirac.submitJob(helloJ)
        gLogger.info("Hello world job: ", result)

        jobID = int(result['Value'])
        jobsSubmittedList.append(jobID)

        self.assertTrue(result['OK'])

        print "**********************************************************************************************************"

        gLogger.info("\n Submitting a job that uploads an output")

        helloJ = LHCbJob()

        helloJ.setName("upload-Output-test")
        helloJ.setInputSandbox( [find_all( 'testFileUpload.txt', '.',
                                           '/LHCbDIRAC/tests/System/GridTestSubmission' )[0]]\
                                            + [find_all( 'exe-script.py', '.',
                                                         '/LHCbDIRAC/tests/System/GridTestSubmission' )[0]] )
        helloJ.setExecutable("exe-script.py", "", "helloWorld.log")

        helloJ.setCPUTime(17800)
        helloJ.setDestination('DIRAC.JobDebugger.cern')

        helloJ.setOutputData(['testFileUpload.txt'])

        result = self.dirac.submitJob(helloJ)
        gLogger.info("Hello world with output: ", result)

        jobID = int(result['Value'])
        jobsSubmittedList.append(jobID)

        self.assertTrue(result['OK'])
예제 #6
0
cwd = os.path.realpath('.')

########################################################################################

gLogger.info("\n Submitting hello world job banning T1s")

helloJ = LHCbJob()
dirac = DiracLHCb()

helloJ.setName("helloWorld-test-T2s")
helloJ.setInputSandbox([
    find_all('exe-script.py', rootPath, '/tests/System/GridTestSubmission')[0]
])

helloJ.setExecutable("exe-script.py", "", "helloWorld.log")

helloJ.setCPUTime(17800)
try:
    tier1s = DMSHelpers().getTiers(tier=(0, 1))
except AttributeError:
    tier1s = [
        'LCG.CERN.cern', 'LCG.CNAF.it', 'LCG.GRIDKA.de', 'LCG.IN2P3.fr',
        'LCG.NIKHEF.nl', 'LCG.PIC.es', 'LCG.RAL.uk', 'LCG.RRCKI.ru',
        'LCG.SARA.nl'
    ]
cernSite = [s for s in tier1s if '.CERN.' in s][0]
helloJ.setBannedSites(tier1s)
result = dirac.submitJob(helloJ)
gLogger.info("Hello world job: ", result)