Developer Guide: Monitoring Tasks

In this guide you'll learn how to monitor the status of Media Strategies API tasks.

Monitoring tasks

Tasks can be monitored by calling the GET /pylon/{service}/task/{type} endpoint.

To monitor a single task, pass the task identifier to GET /pylon/{service}/task/{type}/{id}.

For example to monitor a strategy task with the ID 3ce29d495068a997e9585480cb579cf7d30845b7, we would make the following API call:

GET /pylon/linkedin/task/strategy/b39746f8b4837623b528c793ef7fb84b61998dd

The response from the API includes the status of the task:

{
  "id": "3ce29d495068a997e9585480cb579cf7d30845b7",
  "identity_id": "06b09175dd1b3b724530c50187c84f25",
  "subscription_id": "cd99abbc812f646c77bfd8ddf767a134f0b91e84",
  "name": "Top urls for cloud",
  "type": "strategy",
  "parameters": { ... },
  "result": null,
  "usage": {
    "analysis_tasks": 1
  },
  "steps_completed": 1,
  "total_steps": 3,
  "message": "",
  "status": "running",
  "created_at": 1493740057,
  "updated_at": 1493740067
}

See the GET /pylon/{service}/task/{type} and GET /pylon/{service}/task/{type}/{id} API endpoint documentation for full details on performing these requests.

Task status

When you submit a task to the API it will progress through the following statuses in turn:

  • queued - the task is waiting in your task queue
  • running - the task is currently being processed
  • completed - the task has completed

If a task fails during execution it will be given the status failed, and a message will be added to the message field in the API response.

Please feel free to report any failed strategy tasks to DataSift’s Support team.

Monitoring multiple tasks

You can rely on the platform processing the tasks you submit in the order they are submitted.

If you submit a number of tasks you can monitor the status of the last task you submitted knowing that when it is complete, all the tasks submitted before it will also be complete. Monitoring just the last task will save you making many API calls.