Authentication
Alls APIs are authenticated through Bearer Authentication.
Query Task Status
You can check the status of any task by querying the task
API:
https://api.beam.cloud/v2/task/{TASK_ID}/
This API returns the following data:
- Task ID
- Time the task started, or null if it hasn’t started yet (but is in the queue)
- Time the task ended, or null if it is still running, or hasn’t started yet
- The status of the task
Request
curl -X GET \
--header "Content-Type: application/json" \
--user "{TOKEN}" \
"https://api.beam.cloud/v2/task/{TASK_ID}"
Response
{
"id": "8a918422-9b2c-4f0d-89ee-99e3620f5d2e",
"started_at": "2024-05-04T22:08:25.307049Z",
"ended_at": "2024-05-04T22:08:26.55161Z",
"status": "COMPLETE",
"container_id": "endpoint-577a48b1-9cc4-4cc3-8d45-08a28350346c-32820001",
"updated_at": "2024-05-04T22:08:26.553457Z",
"created_at": "2024-05-04T22:08:18.460463Z",
"stub": {
"id": "577a48b1-9cc4-4cc3-8d45-08a28350346c",
"name": "endpoint/deployment/test2:my_func",
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}
}
Task Statuses
These are all possible states for a task:
Status | Description |
---|
PENDING | The task is enqueued and has not started yet. |
RUNNING | The task is running. |
COMPLETE | The task completed without any errors. |
RETRY | The task is being retried. Defaults to 3, unless max_retries is provided in the function decorator. |
CANCELLED | The task was cancelled by the user. |
TIMEOUT | The task timed out, based on the timeout provided in the function decorator. |
FAILED | The task did not complete successfully. |
Cancel Tasks
Tasks can be cancelled through the api.beam.cloud/v2/task/cancel/
endpoint.
Request
curl -X DELETE --compressed 'https://api.beam.cloud/v2/task/cancel/' \
-H 'Authorization: Bearer [YOUR_TOKEN]' \
-H 'Content-Type: application/json' \
-d '{"task_ids": ["TASK_ID"]}'
This API accepts a list of tasks, which can be passed in like this:
{
"task_ids": [
"70101e46-269c-496b-bc8b-1f7ceeee2cce",
"81bdd7a3-3622-4ee0-8024-733227d511cd",
"7679fb12-94bb-4619-9bc5-3bd9c4811dca"
]
}
Response
200