Skip to content

pman command: status

Rudolph Pienaar edited this page Oct 16, 2017 · 12 revisions

pman command: status

Abstract

This page describes the status command to pman. It is used to return a list field, l_status, describing the end status of the job.

Preconditions

  • export an env variable, HOST_IP containing the IP of the host running the pman service. This var will be used in the examples on this page.
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
  • 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": "status",
        "meta": {
                "key":          "jid",
                "value":        "cal-job-1234"
        }
}' 

status

pfurl calling syntax

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

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

return payload

The above call returns the JSON string:

{
    "RESTverb": "POST",
    "d_ret": {
        "0.start": {
            "startTrigger": [
                true
            ],
            "jobRoot": "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69"
        },
        "l_status": [
            "finishedSuccessfully"
        ],
        "0.end": {
            "jobRoot": "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69",
            "returncode": [
                0
            ]
        }
    },
    "meta": {
        "value": "cal-job-1234",
        "key": "jid"
    },
    "RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
    "status": true,
    "path": "/api/v1/cmd",
    "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: 82\r",
        "\r",
        "{\"payload\": {\"action\": \"status\", \"meta\": {\"value\": \"cal-job-1234\", \"key\": \"jid\"}}}"
    ],
    "payloadsize": 82,
    "action": "status"
}

with the end job status in l_status.

--30--