...
BASEURL/progress/update
- eg https://ws.mwatelescope.org/progress/update?jobid=myjob123&workid=1¤t=5&total=22, https://ws.mwatelescope.org/progress/update?jobid=myjob123&workid=2¤t=10&total=22, https://ws.mwatelescope.org/progress/update?jobid=myjob123&workid=3¤t=21&total=22,
Parameters are:
- jobid: The job ID passed in when this worker was created.
- workid: Arbitrary string, integer or float defining one particular worker process - eg 'worker7', 'node32', 'flagger', etc. Must be unique within this individual job. Displayed as the plot's Y tick labels, so keep it short.
- current: Integer or float representing the progress of this worker so far.
- total: The 'end point' when this worker will have finished. The plot simply shows current/total as a percentage.
- ok: If this parameter is supplied, and equal to zero, then the bar plot for this worker is shown in red, to indicate a problem. The worker could send this status if it exits without finishing cleanly.
- desc: Arbitrary status string to display in the plot, inside or next to the bar for this worker. Keep it short, or the plot will look ugly.
...
Calling these services in your code
In a shell script, it's probably easiest to use 'curl' to call the URL - for example:
$ JOBID=${LOGNAME}:`date -Ins`
$ curl "http://ws.mwatelescope.org/progress/create?jobid=${JOBID}&desc=My+Job"
$ echo "View progress of this job at https://ws.mwatelescope.org/progress/show?jobid=${JOBID}"
That sets the JOBID variable to something unique (login name, followed by an ISO timestamp), displays the viewing URL to the user, and calls the create service. You would then pass the JOBID variable to the worker processes.
Note that if you have an spaces in your description, you need to turn them into '+' characters in the URL passed to curl, or use the --data-urlencode option in the curl command, eg:
$ curl -G --data-urlencode jobid="${JOBID}" --data-urlencode desc="This is my job" http://ws.mwatelescope.org/progress/create
If you're calling these services from Python, the easiest way is to use the requests library - for example:
>>> import requests
>>> requests.get('https://ws.mwatelescope.org/progress/update', params={'jobid':sys.argv[1], 'workid':'flagger1', 'current':7, 'total':50, 'desc':'lots of RFI')