-
Notifications
You must be signed in to change notification settings - Fork 6
Using Ganga with HPS MC Jobs
The hps-mc toolkit has a built-in interface to the Ganga job toolkit, which allows sophisticated management of batch jobs in multiple systems (LSF, PBS, Condor, etc).
hps-mc includes a workflow script for automatically adding jobs to Ganga.
python hps-mc/python/hpsmc/workflow.py -j 1 -n 10 -w ap -g \
-d workdir -u -p 6 ap_job.py job.json
Script arguments from the above example:
- start at job number 1
- create 10 jobs (1-10)
- create workflow called 'ap'
- register the jobs in Ganga
- set the work dir for the unpacked JSON files (a lot of JSON files will be dumped here!)
- automatically unpack JSON files to work dir so that we can submit to Ganga
- use 6 character padding for the job numbers in various filenames
- use an A-prime gen script (uses hps-mc framework)
- use job parameters (format for hps-mc jobs)
In particular, the ‘-g’ switch activates automatic creation of Ganga jobs, and ‘-u’ automatically unpacks all the job JSON files into the work dir so that they are ready for immediate batch submission.
All the batch job management is now done with Ganga, which will manage all of the LSF jobs.
To use the Ganga, interface you need to have it installed in the Python installation you are using.
You can setup a pre-installed python at SLAC using this command:
. /nfs/slac/g/hps/hps_soft/conda/setup.sh
Now, in a shell type ‘ganga’ which opens the special command shell:
Type 'jobs' in this shell to see all the jobs in your Ganga repo and their statuses.
All of your jobs that were just created should have a status of ‘new’ and can be submitted using a simple command like this:
ganga> jobs.submit()
Sophisticated job manipulation can now be performed using interactive Python commands or the Ganga shell commands.
For example, see these docs on how to select jobs by id, status, etc.
Once the jobs are launched, they will be in the LSF system and you may still issue LSF commands like 'bsub' directly from your shell, and Ganga will automatically see the changes.
Questions about this interface or simple usage of Ganga can be posted to the #software channel in the HPS Slack or emailed to the hps software mailing list (the bug tracker of this project is an okay place to post technical questions/comments as well).