JSON API (monitor jobs)

These methods supports listing queue and monitor jobs:

queue watch stat

List content of the queue (queue)

List the content of current selected queue that matches the supplied filter options. The returned result can be optional sorted by server side.

curl -XPOST "http://chemgps.bmc.uu.se/batchelor/api/json/queue?pretty=1"
{
    "status": "success",
    "result": [
        {
            "identity": {
                "jobid": "91ccd8bf-7c0f-48f3-94b3-8eb1da923ad6",
                "result": "15421971205405"
            },
            "status": {
                "queued": {
                    "date": "2018-11-14 13:05:20.082591",
                    "timezone_type": 3,
                    "timezone": "Europe/Stockholm"
                },
                "started": {
                    "date": "2018-11-14 13:05:20.355639",
                    "timezone_type": 3,
                    "timezone": "Europe/Stockholm"
                },
                "finished": {
                    "date": "2018-11-14 13:05:20.382272",
                    "timezone_type": 3,
                    "timezone": "Europe/Stockholm"
                },
                "state": "finished"
            },
            "submit": {
                "task": "default",
                "name": "Job 2"
            }
        },
        {
            "identity": {
                "jobid": "ac051cbd-5a56-4915-b97c-27061462edc4",
                "result": "15421969943499"
            },
                ...
        }
    ]
}

The complete input data is:

{
    "sort": "...",
    "filter": "..."
}

The sort and filter options are enums. For possible values and description, please visit their documentation pages.

Sorting Filter

This example will sort on start time and include all completed jobs (that is, all jobs that finished with either success or warning state):

curl -XPOST "http://chemgps.bmc.uu.se/batchelor/api/json/queue?pretty=1" -d '{"sort":"started","filter":"completed"}'

Get list of jobs finished after a timestamp (watch)

This method can be used by client side to implement polling for completed jobs. Timestamp of each returned job is inject as status.stamp to support progressive increment of watch argument as currently running jobs becomes finished.

curl -XPOST "http://chemgps.bmc.uu.se/batchelor/api/json/watch?pretty=1" -d '{"stamp":1542281262}'
{
    "status": "success",
    "result": [
        {
            "identity": {
                "jobid": "7f22587c-d1e4-4084-8bf4-e9f5d5664840",
                "result": "15422937608783"
            },
            "status": {
                "queued": {
                    "date": "2018-11-15 15:56:00.294915",
                    "timezone_type": 3,
                    "timezone": "Europe/Stockholm"
                },
                "started": null,
                "finished": null,
                "state": "pending",
                "stamp": 1542293760
            },
            "submit": {
                "task": "default",
                "name": null
            }
        },
        {
            "identity": {
                "jobid": "d52f6e17-e6c3-41a7-9bb6-7ae652a48fdf",
                "result": "15422938272592"
            },
            "status": {
                "queued": {
                    "date": "2018-11-15 15:57:07.686520",
                    "timezone_type": 3,
                    "timezone": "Europe/Stockholm"
                },
                "started": null,
                "finished": null,
                "state": "pending",
                "stamp": 1542293827
            },
            "submit": {
                "task": "default",
                "name": null
            }
        },
        {
            "identity": {
                "jobid": "5fba15b2-9c51-4cbf-a5ff-1801616623aa",
                "result": "15422947593926"
            },
                ...
        }
    ]
}

The complete input data is:

{
    "stamp": 1713547364
}

Get status of a single job (stat)

This method can be used to implement client side polling for a single job completion. The response provide the necessary data for progressive update the user interface as job state changes.

curl -XPOST "http://chemgps.bmc.uu.se/batchelor/api/json/stat?pretty=1" -d '{"jobid":"3c980fc7-5807-4dc5-b2a4-861c20c63906","result":"1542313123894"}'
{
    "status": "success",
    "result": {
        "queued": {
            "date": "2018-11-15 21:18:44.182470",
            "timezone_type": 3,
            "timezone": "Europe/Stockholm"
        },
        "started": null,
        "finished": null,
        "state": "pending"
    }
}

The complete input data is:

{
    "jobid": "6633e06c-deaf-4222-bbdf-036e4be4f0a0",
    "result": "f52764d624db129b32c21fbca0cb8d6"
}