Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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')