Parametric jobs

From BiGGrid Wiki
Jump to navigation Jump to search

A parametric job causes a set of jobs to be generated from one JDL file. This is invaluable in cases where many similar (but not identical) jobs must be run. This is achieved by the parametric job having one or more parametric attributes described in the JDL. These attributes are identified by use of the key word _PARAM_ in its value; that value will be replaced by the actual value of Parameters during the jdl expansion. The JobType in the JDL should be Parametric.

In this example a set of values of the parameters is defined by the three attributes Parameters, ParameterStep and ParameterStart. ParameterStart defines the starting value for the variation, ParameterStep the step for each variation and Parameters defines the value where the submission of jobs will stop (that value itself is not used) . The number of jobs is (Parameters – ParameterStart) / ParameterStep

$ cat parametric.jdl
 [
    JobType = "Parametric";
    Executable = "/bin/sh";
    Arguments = "message_PARAM_.sh";
    InputSandbox = "message_PARAM_.sh";
    Parameters= 6;
    ParameterStep =2;
    ParameterStart = 0;
    StdOutput = "myoutput_PARAM_.txt";
    StdError = "myerror_PARAM_.txt";
    OutputSandbox  = {"myoutput_PARAM_.txt", "myerror_PARAM_.txt"};
    ShallowRetryCount = 1;
]

In this case, 3 jobs will be generated, from the execution of the bash script message0.sh, message2.sh and so on up to message4.sh (the last value of Parameters being excluded). Note that the coherence of the Input Sandbox is up to the user: it does mean that, in this example, the user has to provide 3 files called message0.sh, message2.sh and so on, to be carried within the Input Sandbox. In this case you can easily create them in the follwing way

for ((i=0;i<6;i+=2)) ; do echo "echo message number $i" > message$i.sh; done

and then submit and monitor the jobs status

glite-wms-job-submit -o jobIdWMP -d $USER parametric.jdl

glite-wms-job-status -i jobIdWMP

When the jobs have completed, you will see in the different subdirectories the different outputs, each with the parametrised name.