Operations
An Operation represents an asynchronous action performed on a deployment or other resource. Operations track the progress of deployments, destructions, and other long-running tasks.
What is an Operation?
Operations are created when you perform actions that take time to complete:
- Creating a deployment
- Destroying a deployment
- Syncing DAGs from GitHub
- Provisioning user
Each operation has:
- ID - Unique identifier (format:
op_...) - Type - Operation type (e.g.,
deployment.create) - Status - Current status
- Progress - Phase and message
- Resource - Linked resource (deployment, etc.)
- Timestamps - Requested, started, ended
Operation Statuses
Operations have the following statuses:
queued- Operation is queued and waiting to startrunning- Operation is currently executingsucceeded- Operation completed successfullyfailed- Operation failedcanceled- Operation was canceled
Terminal vs Non-Terminal States
Terminal States
These states indicate the operation will not change:
succeeded- Operation completed successfullyfailed- Operation failedcanceled- Operation was canceled
Non-Terminal States
These states indicate the operation is still in progress:
queued- Waiting to startrunning- Currently executing
Polling Patterns
Since operations are asynchronous, you need to poll for status updates.
Basic Polling
Poll the operation endpoint until it reaches a terminal state:
# Get operation status
onvera ops get op_660e8400-e29b-41d4-a716-446655440001CLI Polling
The CLI automatically polls for you:
# Deploy command polls automatically
onvera deploy supersetThe CLI polls every 2 seconds and shows progress updates.
API Polling
Using the API, poll the operation endpoint:
# Poll operation status
curl -H "X-API-Key: onv_sk_live_..." \
https://api.onvera.io/api/v1/operations/op_660e8400-e29b-41d4-a716-446655440001Polling interval: Poll every 2-5 seconds. Don't poll too frequently to avoid rate limits.
Operation Progress
Operations include progress information:
- Phase - Current phase (e.g.,
provisioning_db,provisioning_infrastructure) - Message - Human-readable message describing current state
Example progress:
Phase: provisioning_db
Message: Provisioning databaseOperation Types
Common operation types:
deployment.create- Creating a deploymentdeployment.destroy- Destroying a deploymentdag_sync.trigger- Syncing DAGs from GitHubapp_user.provision- Provisioning a user in an application
Resources vs Operations
Resources
Resources are the entities you manage:
- Deployments - Application instances
- Operations - Async actions (also resources themselves)
Operations
Operations track actions on resources:
- Creating a deployment →
deployment.createoperation - Destroying a deployment →
deployment.destroyoperation
Key distinction: Resources are the "things" you manage. Operations are the "actions" you perform on them.
Example: Deployment Flow
- Create deployment:
onvera deploy supersetReturns:
deployment_id:dep_550e8400-e29b-41d4-a716-446655440000operation_id:op_660e8400-e29b-41d4-a716-446655440001
- Poll operation:
onvera ops get op_660e8400-e29b-41d4-a716-446655440001Shows:
- Status:
running - Phase:
provisioning_db - Message:
Provisioning database
- Continue polling until terminal state:
- Status:
succeeded→ Deployment is ready - Status:
failed→ Check error message
Best Practices
- Always store the operation_id when creating resources
- Poll until terminal state - Don't assume immediate completion
- Handle failures gracefully - Check error messages
- Respect rate limits - Don't poll too frequently
- Use exponential backoff for retries
Related Concepts
- Environments - Understand environments that contain deployments
- Deployments - Learn about deployments that operations are performed on
- API Operations - API reference for operations