Skip to content

pman command: get

Rudolph Pienaar edited this page Feb 20, 2018 · 13 revisions

pman command: get

Abstract

This page describes the get command to pman. It is used to simply get information from the pman database / datatree.

Preconditions

  • Make sure that pman has been started (see here for more info):
pman --rawmode 1 --http  --port 5010 --listeners 12
  • A HOST_IP environment variable that denotes the IP of the host housing the service. In Linux, you can do:
export HOST_IP=$(ip route | grep -v docker | awk '{if(NF==11) print $9}')
  • 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": "get",
        "meta": {
                "path":        "/"
        }
}

get

purl prefix

Start the purl command with

purl --verb POST --raw --http 172.17.0.2:5010/api/v1/cmd --jsonwrapper 'payload'  --msg \

simple copy/paste the above line into a terminal. Do not press enter!

msg suffix

Assuming satisfied preconditions, let's simply get some elements directly from the pman database/datatree. The representation of data in the pman database is directly equivalent also to how data is saved to the pman database on the host machine running the pman service.

Append (copy/paste) the following to the purl prefix command above and hit enter:

'{  "action": "get",
        "meta": {
                "path":        "/"
        }
}' --quiet --jsonpprintindent 4      

return payload

The above returns a JSON string

{
    "payloadsize": 53,
    "meta": {
        "path": "/"
    },
    "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: 53\r",
        "\r",
        "{\"payload\": {\"action\": \"get\", \"meta\": {\"path\": \"/\"}}}"
    ],
    "RESTheader": "POST /api/v1/cmd HTTP/1.1\r",
    "RESTverb": "POST",
    "action": "get",
    "path": "/api/v1/cmd",
    "status": true,
    "d_ret": {
        "20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f": {},
        "20170308164211.942222_5f540393-9ed4-489e-8a65-1ae636d16424": {},
        "20170309104249.802089_60befd86-e8b3-44ae-b80f-2b45cab14313": {},
        "20170309103920.158002_81c65d31-383a-4c79-be80-0ffff2bfd5ad": {},
        "20170303164938.122651_6e09943c-6fc0-45c8-b088-2394e5886b69": {},
        "20170309104746.783742_5b9fcb3d-2e1b-4caa-bc87-84bfb5c2cd70": {},
        "20170303210038.021641_828b47d8-d64d-4078-8a19-5f202c069d78": {},
        "20170303210026.421217_72c99079-d099-441b-b005-98076e37002b": {}
    }
}

which defines the set of jobs that have been managed and exist in the pman database. By creating correct paths in the get directive, the entire dataspace can be explored. For example, the set of data corresponding to one of the jobs:

'{  "action": "get",
        "meta": {
                "path":        "/20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f"
        }
}' --quiet --jsonpprintindent 4

or even a specific quantum of information in the treespace of that job:

'{  "action": "get",
        "meta": {
                "path":        "/20170309101124.645898_fc21bad8-6044-4a4f-9e60-3176912e141f/end/0/endInfo/0/platform"
        }
}' --quiet --jsonpprintindent 4

--30--