The new jobsub_api
allows users to import and use jobsub functionality programmatically through high-level functions that mimic the jobsub_*
commands. The main functions users will use are jobsub_api.submit()
and jobsub_api.q()
, similar to how users now mainly use jobsub_submit
and jobsub_q
. For the most part, the function signatures will mirror the command-line options - for example, jobsub_api.submit()
accepts an f
argument that corresponds to the -f
command line option, a tar_file_name
argument that corresponds to the --tar-file-name
option, etc. Both jobsub_api.submit()
and jobsub_api.q()
will raise jobsub_api.JobsubAPIError
s if they fail. Like the example below shows, users can catch that error to handle it as they see fit.
jobsub_fetchlog
translates to a method on the returned class (jobsub_api.SubmittedJob
) from jobsub_api.submit()
.
import sys
sys.path.append('/opt/jobsub_lite/lib')
import jobsub_api