Skip to content

pman command: done

Rudolph Pienaar edited this page Mar 24, 2017 · 10 revisions

pman command: done

Abstract

This page describes the done command to pman. It is used to simply determine if a job is done.

Preconditions

  • This page assumes that pman is listening on: 172.17.0.2:5010.
  • Make sure that pman has been started (see here for more info):
pman --rawmode 1 --http  --port 5010 --listeners 12
  • This page assumes that a previous run has been managed with parameters
{  "action": "run",
        "meta": {
                "cmd":      "cal 7 1970",
                "auid":     "rudolphpienaar",
                "jid":      "cal-job-1234",
                "threaded": true
        }
}

msg summary

The msg payload of the REST interaction with pman is:

'{  "action": "done",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' 

done

purl calling syntax

Assuming satisfied preconditions, let's search for the done information about a process. For example, let's ask for the done state of the app with jid of cal-job-1234:

purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{  "action": "done",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' --quiet --jsonpprintindent 4  

Using the dockerized version of purl

To use the dockerized version of purl, and assuming a pman on the given IP:

Using the source repo

If you have cloned the source repo, you can cd to the root directory and execute the docker helper scripts in the docker-bin directory.

docker-bin/purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{  "action": "done",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' --quiet --jsonpprintindent 4  
Calling docker directly

The helper script just creates a docker run command line string. You can run this string directly without using the helper script and directly calling the docker app:

docker run --name pman -v /home:/Users --rm -ti fnndsc/pman purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload' --msg \
'{  "action": "done",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' --quiet --jsonpprintindent 4  

return payload

The above call returns the JSON string:

{
    "RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
    "meta": {
        "value": "cal-job-1234",
        "key": "jid"
    },
    "d_ret": {
        "0.start": {
            "startTrigger": [
                true
            ],
            "jobRoot": "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69"
        },
        "0.end": {
            "jobRoot": "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69",
            "returncode": [
                0
            ]
        }
    },
    "receivedByServer": [
        "POST /api/v1/cmd HTTP/1.1\r",
        "Host: 172.17.0.2:5010\r",
        "User-Agent: PycURL/7.43.0 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3\r",
        "Accept: */*\r",
        "Content-type: application/vnd.collection+json\r",
        "Content-Length: 80\r",
        "\r",
        "{\"payload\": {\"meta\": {\"key\": \"jid\", \"value\": \"cal-job-1234\"}, \"action\": \"done\"}}"
    ],
    "RESTverb": "POST",
    "status": true,
    "path": "/api/v1/cmd",
    "payloadsize": 80,
    "action": "done"
}

where the d_ret field indicates that the job has started and also ended with returncode of 0.

--30--