Querying a Running Workflow

To query a running workflow, you must first create a request for the API.

Procedure

  • Create a request that looks something like this:
    ROOT_URL/processes/$processId/query?token=$token
    where
    • $processId is the process ID returned in the "run workflow" API.
    • $token is the API authentication token. This is the same as the Team Studio session ID. The authentication token also can be used in the header without the token query parameter. The session ID can be found at http://host:port/api/sessions.

    Note that this request should use the HTTP GET protocol.

    Sample:

    curl -i http://localhost:8080/alpinedatalabs/api/v1/json/processes/38933dd6-ecdd-4b65-b7ca-56d2bdb089be/query?token=4dcd1fa7eca1a210fb5581a8740ed8775db6b827

    Response:

    If the workflow is still running, a successful response will look like the following code:

    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: application/json;charset=UTF-8
    Content-Length: 503
    Date: Mon, 07 Apr 2014 21:30:03 GMT
     
    {"meta":{"workflowId":"43","processId":"38933dd6-ecdd-4b65-b7ca-56d2bdb089be","user":"1","state":"IN_PROGRESS"},"message":"In progress, processing node: K-Means, message:{\"analyticNodeId\":\"1396375156698\",\"analyticNodeName\":\"K-Means\",\"messageType\":\"Info\",\"timeStamp\":\"Apr 7, 2014 2:30:03 PM\",\"props\":{\"hadoop.job.id\":\"job_local_0008\",\"hadoop.job.reduce.progress\":\"0.0\",\"hadoop.job.name\":\"K-Means : AlpineKmeans_Output\",\"hadoop.job.map.progress\":\"100.0\"}}","results":""}

    If the workflow is already stopped, the response will look like the following code:

    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: application/json;charset=UTF-8
    Content-Length: 47
    Date: Mon, 07 Apr 2014 21:32:21 GMT
     
    invalid processId or workflow already stopped.
Related concepts
Related reference