TaskStatusEnum.
TaskStatusEnum
IN_PROGRESS, CANCELED, SKIPPED, UNKNOWN, DRAFT, ACTIVE, ARCHIVED, and SUSPENDED. All async resources in Mixpeek adopt this enum, so your polling logic works everywhere.
Anatomy of a Task
- Cached in Redis for ~24 hours (fast lookup).
- Persisted in MongoDB for historical auditing.
additional_datastores resource-specific details (e.g., Ray job IDs).
Polling Strategy
1
Poll the task
Query
/v1/tasks/{task_id} with exponential backoff (start at 1s, cap at 30s).2
Handle 404 gracefully
After Redis TTL expires you may receive
404; fall back to the underlying resource (batch, cluster, etc.).3
Switch to resource polling
Use
/v1/buckets/{bucket_id}/batches/{batch_id}, /v1/clusters/{cluster_id}, etc., for long-running operations.Webhooks & Notifications
- Engine emits webhook events (e.g.,
collection.documents.written) when tasks complete relevant work. - Celery Beat dispatches those events to invalidate caches, update schemas, and notify external systems.
- Prefer webhooks for near-real-time updates instead of aggressive polling.
Managing Tasks
GET /v1/tasks/{task_id}– fetch the latest status.POST /v1/tasks/list– filter by type, status, namespace, or creation time.POST /v1/tasks/{task_id}/kill– request cancellation (supported for batches and clustering jobs using Celery’sAbortableAsyncResult).
Best Practices
- Store task IDs returned by submit endpoints.
- Use exponential backoff to avoid hammering the API.
- Respect terminal states (
COMPLETED,FAILED,CANCELED) and surface errors to operators. - Leverage webhooks for side-effects like cache invalidation or notifications.
- Instrument monitoring—task history in MongoDB plus webhook logs provide a full audit trail.

