Skip to main content

Waiters - TypeScript SDK

Waiters poll until a terminal state, tolerate a bounded number of transient read errors, and throw on failure or timeout.

Overview​

Available Operations​

MethodDescription
waitForDeployment(id, options?)Wait for RUNNING; fail on FAILED or STOPPED.
waitForTrainingJob(id, options?)Wait for SUCCEEDED; fail on FAILED or CANCELLED.
waitForEvaluationJob(id, options?)Wait for SUCCEEDED; fail on FAILED or CANCELLED.
waitForDatasetPreparation(id, options?)Wait for the requested rules_ready milestone or completed; fail on ERROR or CANCELLED.
waitForJob(id, options?)Wait for SUCCEEDED; fail on FAILED or CANCELLED.

waitForDeployment​

Wait for RUNNING; fail on FAILED or STOPPED.

Request​

id; optional timeoutMs=1800000, intervalMs=5000, maxConsecutiveErrors=3.

Response​

Final Deployment object.

waitForTrainingJob​

Wait for SUCCEEDED; fail on FAILED or CANCELLED.

Request​

id; same waiter options.

Response​

Final Training job object.

waitForEvaluationJob​

Wait for SUCCEEDED; fail on FAILED or CANCELLED.

Request​

id; same waiter options.

Response​

Final Evaluation job object.

waitForDatasetPreparation​

Wait for the requested rules_ready milestone or completed; fail on ERROR or CANCELLED.

Request​

id; optional until, default completed; same waiter timing options.

Response​

Latest preparation object.

waitForJob​

Wait for SUCCEEDED; fail on FAILED or CANCELLED.

Request​

id; same waiter options.

Response​

Final generic job object.

Field Reference and Examples​

OperationFailedError carries the terminal status and full result. WaitTimeoutError reports the last observed status. Only transient connection and timeout errors count toward maxConsecutiveErrors; API and validation errors fail immediately.

Dataset Preparation uses lowercase wire statuses. Waiting for rules_ready accepts that milestone and later successful phases; it never treats error or cancelled as success.

const deployment = await client.waitForDeployment(42, {
timeoutMs: 1_800_000,
intervalMs: 5_000,
});
const training = await client.waitForTrainingJob("training-id", { timeoutMs: 86_400_000 });
const evaluation = await client.waitForEvaluationJob("evaluation-id", { timeoutMs: 86_400_000 });
const rules = await client.waitForDatasetPreparation(17, { until: "rules_ready" });
const prepared = await client.waitForDatasetPreparation(17);
const job = await client.waitForJob("job-id", { timeoutMs: 86_400_000 });

All methods use the shared authentication and typed error behavior described in Response Conventions and Retry and Security.