Example Application: Job Submit and List
To demonstrate the utility of the REST API, here are two simple Python programs that imitate the function of the nc run and nc list commands that are familiar CLI tools from the Accelerator product. The source code for these tools, named nc_run.py and nc_list.py, is found on the following pages.
These REST programs only require that the NC_URL environment variable be set to the Accelerator queue URL, as returned by nc cmd vovbrowser. Here is a terminal image that demonstrates the simple REST tools.
% cp $VOVDIR/scripts/python/vov_rest_v3.py .
% export NC_URL="`nc cmd vovbrowser`"
% ./nc_run.py sleep 33
Password:
New job is 45080
% ./nc_run.py sleep 66
Password:
New job is 45083
% ./nc_list.py
Password:
ID STATUSNC PRIORITYP HOST COMMAND
000045080 Running normal myhost vw sleep 33 > JOBLOG.185633
000045083 Running normal myhost vw sleep 66 > JOBLOG.903723