Guides

Track and wait for operations

Wait for work to finish, find an operation, and retry a create request

An operation records work such as creating, branching or deleting a resource. Use its ID to follow the result without starting the work again.

You need the CLI installed and signed in and a workspace selected where you have the admin or editor role. The name demo-ops must be free in that workspace.

Wait with the command

Create a computer with the platform defaults. Pick an unused idempotency key and keep it if you need to retry this request:

nevia new demo-ops --idempotency-key demo-ops-create-1 --wait
nevia status demo-ops

--wait follows the operation until it finishes or fails. On success, status shows ready with no pending transition. See Create a computer for image and configuration choices.

If the wait times out, the operation keeps running. Continue waiting by ID.

Find and wait for an operation

List recent operations in the selected workspace:

nevia ops

Find the computer.create row whose RESOURCE matches the computer ID that nevia status demo-ops prints. The row shows the operation ID and state. To list only running work:

nevia ops -f state=running

Copy the ID from the OPERATION column. Replace 01d4cnjm89yk0r3xtv80dy0x7by below with that ID:

nevia wait 01d4cnjm89yk0r3xtv80dy0x7by --timeout 10m

On success, the command reports finished. Check the computer again with nevia status demo-ops. If the operation failed, read the reported error and the computer's current state before you decide what to do.

You can also wait on an operation ID from an earlier command or from an operation_in_progress error. Waiting again after a timeout picks up the same work and doesn't restart a failed operation.

Retry a create after losing the response

Run nevia status demo-ops and nevia ops first. If you have an operation ID, wait for it.

To repeat the create request, send the same key, name, workspace and options as the original:

nevia new demo-ops --idempotency-key demo-ops-create-1 --wait

Within 24 hours, the API replays a stored response by returning the original computer and operation. Send retries one at a time, because simultaneous requests with the same key are not combined. A new create needs a new key. See Operations and idempotency for replay limits and which actions support it.

Clean up

Once creation has finished, delete the example computer and its data:

nevia rm demo-ops --yes --wait

The command reports that the computer was deleted.

For filters, see nevia ops. For wait options, see nevia wait. The same approach works when creating a database.

On this page