View Command Status

GET /api/v1.2/commands/(int: command_id)

Use this API to check the status of any command. A user can check any query for the whole account.

Required Role

The following users can make this API call:

  • Users who belong to the system-user or system-admin group.

  • Users who belong to a group associated with a role that allows viewing command status. See Managing Groups and Managing Roles for more information.

Example

curl -i -X GET -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
"https://api.qubole.com/api/v1.2/commands/${QUERYID}"

Note

The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.

Sample response:

{
   "id": 59361366,
   "path": "/tmp/2019-09-17/519/59361366",
   "status": "done",
   "created_at": "2019-09-17 23:37:14 UTC",
   "updated_at": "2019-09-17 23:37:29 UTC",
   "command_type": "PrestoCommand",
   "progress": 100,
   "qbol_session_id": 8468029,
   "qlog": "{\"QBOL-QUERY-SCHEMA\":{\"query0\":
   [{\"ColumnName\":\"number_of_records\",\"ColumnType\":\"integer\"},
   {\"ColumnName\":\"number_of_records1\",\"ColumnType\":\"integer\"},
   {\"ColumnName\":\"product_name\",\"ColumnType\":\"varchar\"},
   {\"ColumnName\":\"views\",\"ColumnType\":\"bigint\"}]},\"messages\":
   [{\"message_type\":\"SUCCESS\"}]}",
   "resolved_macros": null,
   "template": "generic",
   "submit_time": 1568763434,
   "start_time": 1568763438,
   "end_time": 1568763445,
   "can_notify": false,
   "pool": null,
   "timeout": null,
   "name": null,
   "command_source": "API",
   "nominal_time": null,
   "sequence_id": null,
   "account_id": 519,
   "saved_query_mutable_id": null,
   "user_id": 4604,
   "label": "presto-baseline",
   "meta_data": {
       "results_resource": "commands/59361366/results",
       "logs_resource": "commands/59361366/logs"
                },
   "uid": 16,
   "email": "[email protected]",
   "command": {
       "md_cmd": false,
       "query": "SELECT 1 AS \"number_of_records\",\n
   \"custom_sql_query\".\"number_of_records\" AS \"number_of_records1\",\n
   \"custom_sql_query\".\"product_name\" AS \"product_name\",\n
   \"custom_sql_query\".\"views\" AS \"views\"\nFROM (\n  SELECT 1 AS
   \"number_of_records\",\n    \"custom_sql_query\".\"Product_Name\" AS \"product_name\",\n
   \"custom_sql_query\".\"Views\" AS \"views\"\n  FROM (\n    select \n
   \tregexp_replace(REVERSE(split(REVERSE(url), '/')[1]),'%20', ' ') as Product_Name,\n
   \tcount(*) as Views \n    from \n    \tecommerce_db.access_logs\n    where \n    \turl like
   '%/product/%'\n    group by \n    \turl \n    order by \n    \tViews desc\n    limit 10\n  )
   \"custom_sql_query\"\n  LIMIT 1000\n) \"custom_sql_query\"\nLIMIT 1000",
   "script_location": null
     },
   "throttled": false,
   "cluster_inst_id": 123456,
   "cluster_id": 1234
}

Note

If the maximum concurrency of the account has been reached, the API contains an additional throttled field set to true. The status of the command will still be in the waiting state.

When checking the status of a Hadoop command, the JSON response object contains an additional field (job_url), the value of which is URL to JobTracker page specific to this job. A detailed information related to the job such as the number of mappers and reducers, current status, counters, and so on can be retrieved using this URL.

A command’s status can have one of the following values:

  • cancelled

  • done

  • error

  • running

  • waiting