Stopping a Running Workflow

You can stop a running workflow by creating a request for the API.

Create the API request from your favorite authoring environment. Run the API calls from outside Team Studio.

Procedure

  • Create a request that looks something like the following code:
    ROOT_URL/processes/$processId/stop?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/sessions.

    Optional query parameters:

    • stopTimeOut: default to 2 seconds. This is how long the client waits to determine whether the stop command is accepted.

    Note that this request should use HTTP POST protocol.

    Sample:

    curl -i -X POST http://localhost:8080/alpinedatalabs/api/v1/json/processes/a2880a70-b61c-4890-b87d-fd26d3f1048e/stop?token=4dcd1fa7eca1a210fb5581a8740ed8775db6b827

    Response:

    If the workflow is still running, the response looks like the following:

    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Content-Type: application/json;charset=UTF-8
    Content-Length: 18
    Date: Mon, 07 Apr 2014 21:08:40 GMT
     
    request accepted.

    Acceptance of the stop command request does not mean the job will be stopped. The system tells the workflow engine to stop the flow; this in turn communicates to the Hadoop job (if the data source is Hadoop) to stop. So the job might be still running on the back end.

    If the workflow is already stopped, the response looks like the following:

    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:09:26 GMT
     
    Invalid processId or Workflow already stopped.
Related concepts
Related reference