Version 2 (modified by minondoa, 6 years ago) (diff) |
---|
How to create a job
The API allows the creation of jobs using a Job object. This example shows how to create a "sleep" job:
>>> from drm4g.api import Job, DRM4G >>> job = Job() >>> job.set_name( "Template sleep" ) >>> job.set_executable( "/bin/sleep" ) >>> job.set_arguments( "1" ) >>> job.set_np( 1 )
How to submit a job
To submit a job use the "submit" method of the DRM4G object:
>>> drm4g = DRM4G() >>> job_id = drm4g.submit( job ) >>> print job_id 0
How to monitor a job
Once you have submitted a job, you can use the "status" method to keep track of your job:
>>> status = drm4g.status( job_id ) >>> print status {'EM': '----', 'DM': 'done', 'END': '13:02:58', 'EXEC': '0:00:06', 'START': '13:02:49', 'HOST': 'localmachine/fork', 'EXIT': '0', 'XFER': '0:00:00'}
To obtain more information about classes and methods use the help() function ( e.g. help(Job) )