Getting Started
API Reference
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 \
'https://api.beam.cloud/v2/task/{TASK_ID}/' \
-H 'Authorization: Bearer [YOUR_AUTH_TOKEN]' \
-H 'Content-Type: application/json'
Response
{
"id":"e7c532b3-f2be-4b6a-9649-cffb9f775eba",
"started_at":"2024-06-13T22:45:01.547676Z",
"ended_at":"2024-06-13T22:45:19.352778Z",
"status":"COMPLETE",
"container_id":"endpoint-62932d8e-c945-4538-a54f-748742e518fc-ab3f5253",
"updated_at":"2024-06-13T22:45:19.354395Z",
"created_at":"2024-06-13T22:44:49.383043Z",
"outputs":[
],
"stub":{
"id":"62932d8e-c945-4538-a54f-748742e518fc",
"name":"endpoint/deployment/app:generate_image",
"type":"",
"config":"{\"runtime\":{\"cpu\":4000,\"gpu\":\"A10G\",\"memory\":16384,\"image_id\":\"5ed08e7bcdaa3210\"},\"handler\":\"app:generate_image\",\"on_start\":\"app:load_models\",\"python_version\":\"python3.10\",\"keep_warm_seconds\":120,\"max_pending_tasks\":100,\"callback_url\":\"\",\"task_policy\":{\"max_retries\":0,\"timeout\":180,\"expires\":\"0001-01-01T00:00:00Z\"},\"workers\":0,\"authorized\":true,\"volumes\":[{\"id\":\"fee0be2f-15f1-4147-8959-f501b3d78e8e\",\"mount_path\":\"./models\"}],\"autoscaler\":null}",
"config_version":0,
"object_id":0,
"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
{}
Was this page helpful?