Parametric jobs with DIRAC Python API

20 views
Skip to first unread message

Francisco VazquezdeSola

unread,
Apr 7, 2023, 9:11:52 AM4/7/23
to diracgrid-forum

I have a question on proper usage of the DIRAC Python API, please let me know if this is not the preferred channel for these questions.

My situation is the following. If I run a single job as follows, I have no issues (job1, input1 and output1 are the names of the script to be run, the input file, and the output file):

from DIRAC.Core.Base import Script
Script.initialize() #I want to avoid parseCommandLine()

from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

j = Job()
j.setInputSandbox([job1, input1])
j.setOutputSandbox([job1, input1, output1])
j.setExecutable(job1)

dirac = Dirac()
dirac.submitJob(j)


However, if I try to run different jobs parametrically, inspired by the examples here:

from DIRAC.Core.Base import Script
Script.initialize() #I want to avoid parseCommandLine()

from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

joblist = [job1, job2, job3]
inputlist = [input1, input2, input3]
outputlist = [output1, output2, output3]

j=job()
zippedinputsandbox = [list(t) for t in zip(joblist, inputlist) ]
j.setParameterSequence('InputSandbox', zippedinputsandbox)
zippedoutputsandbox = [list(t) for t in zip(joblist, inputlist, outputlist) ]
j.setParameterSequence('OutputSandbox', zippedoutputsandbox)

j.setParameterSequence("jobs", joblist)
j.setExecutable("sh", arguments = "%(jobs)s")

dirac = Dirac()
dirac.submitJob(j, mode='local')


Then I have issues. The script gets launched, but the input files don't seem to get sent to the worker node. I have tried different syntaxes for parametric jobs, but I am having no luck. Could I get confirmation about whether this is the proper way to do this?


Francisco VazquezdeSola

unread,
Apr 7, 2023, 9:34:18 AM4/7/23
to diracgrid-forum

5 minutes after posting this thread, I noticed the warning from last year that said this forum is closing in favour of the one on github. Please, instead of replying here, do so there.
Reply all
Reply to author
Forward
0 new messages