Skip to main content

Get Task Status

View as Markdown

Overview

The get_task_status() (Python) / getTaskStatus() (TypeScript) method retrieves the current status and detailed metrics of a running pipeline. Use it to monitor progress, check for errors, and determine when processing is complete.

Method Signature

Python (async)

status = await client.get_task_status(token)

TypeScript

const status = await client.getTaskStatus(token);

Parameters

ParameterTypeRequiredDescription
tokenstr / stringYesTask token returned by use()

Returns

  • Type: TASK_STATUS, a dictionary/object with comprehensive status fields

Key Fields

FieldTypeDescription
stateintCurrent task state (see Task States)
completedboolWhether the task has finished execution
namestrPipeline name
project_idstrProject identifier
sourcestrSource component ID
startTimefloatTask start timestamp (Unix time)
endTimefloatTask completion timestamp (Unix time)
totalCountintTotal items to process
completedCountintItems processed successfully
failedCountintItems that failed processing
totalSizeintTotal size in bytes
completedSizeintBytes processed successfully
rateCountintCurrent processing rate (items/sec)
rateSizeintCurrent processing rate (bytes/sec)
errorslist[str]Recent error messages (max 50)
warningslist[str]Recent warning messages (max 50)
statusstrCurrent status message
currentObjectstrItem currently being processed
exitCodeintProcess exit code (0 = success)
exitMessagestrExit message details
metricsTASK_METRICSCPU, memory, and GPU utilization
tokensTASK_TOKENSToken usage for billing
pipeflowTASK_STATUS_FLOWPipeline component execution flow

Metrics Fields (metrics)

FieldTypeDescription
cpu_percentfloatCurrent CPU utilization (0-100%)
cpu_memory_mbfloatCurrent RAM usage in MB
gpu_memory_mbfloatCurrent GPU VRAM usage in MB
peak_cpu_percentfloatPeak CPU utilization
peak_cpu_memory_mbfloatPeak RAM usage in MB
peak_gpu_memory_mbfloatPeak GPU VRAM usage in MB

Token Usage Fields (tokens)

FieldTypeDescription
cpu_utilizationfloatCumulative CPU utilization tokens
cpu_memoryfloatCumulative CPU memory tokens
gpu_memoryfloatCumulative GPU memory tokens
totalfloatTotal cumulative tokens

Usage Examples

Basic Status Check

from rocketride import RocketRideClient

async with RocketRideClient(auth='your-api-key') as client:
result = await client.use(filepath='pipeline.json')
token = result['token']

status = await client.get_task_status(token)
print(f'State: {status["state"]}')
print(f'Progress: {status["completedCount"]}/{status["totalCount"]}')
import { RocketRideClient } from 'rocketride';

const client = new RocketRideClient({ auth: 'your-api-key' });
await client.connect();

const result = await client.use({ filepath: './pipeline.json' });
const status = await client.getTaskStatus(result.token);
console.log(`State: ${status.state}`);
console.log(`Progress: ${status.completedCount}/${status.totalCount}`);

await client.disconnect();

Polling Until Completion

import asyncio

status = await client.get_task_status(token)
while not status['completed']:
print(f'Processing: {status["completedCount"]}/{status["totalCount"]}')

if status['errors']:
for error in status['errors']:
print(f'Error: {error}')

await asyncio.sleep(2)
status = await client.get_task_status(token)

print(f'Pipeline finished with exit code: {status["exitCode"]}')
let status = await client.getTaskStatus(token);
while (!status.completed) {
console.log(`Processing: ${status.completedCount}/${status.totalCount}`);
await new Promise(resolve => setTimeout(resolve, 2000));
status = await client.getTaskStatus(token);
}
console.log('Pipeline complete!');

Task States

StateValueDescription
NONE0Initial state: no resources allocated
STARTING1Resource allocation and subprocess preparation
INITIALIZING2Subprocess initialization and service startup
RUNNING3Operational: actively processing requests
STOPPING4Graceful shutdown in progress
COMPLETED5Finished successfully: resources cleaned up
CANCELLED6Terminated before completion

State Transitions

NONE → STARTING → INITIALIZING → RUNNING → STOPPING → COMPLETED
→ STOPPING → CANCELLED

Response Format

The method returns the full TASK_STATUS object. Here's an example:

{
"name": "text_analyzer",
"project_id": "my-project",
"state": 3,
"completed": false,
"startTime": 1700000000.0,
"endTime": 0.0,
"totalCount": 100,
"completedCount": 45,
"failedCount": 2,
"rateCount": 5,
"errors": [],
"warnings": [],
"metrics": {
"cpu_percent": 25.3,
"cpu_memory_mb": 512.0,
"gpu_memory_mb": 1024.0
},
"tokens": {
"cpu_utilization": 1.5,
"cpu_memory": 0.8,
"gpu_memory": 2.1,
"total": 4.4
},
"pipeflow": {
"totalPipes": 2,
"byPipe": {
"0": ["source", "transform", "filter"],
"1": ["source", "transform"]
}
}
}

Error Handling

ErrorCause
RuntimeError / ErrorStatus retrieval failed (e.g., invalid token, server error)
Authentication errorInvalid or missing API key
try:
status = await client.get_task_status(token)
except RuntimeError as e:
print(f'Failed to get status: {e}')

API Endpoint

This method communicates via the RocketRide DAP protocol over WebSocket. The equivalent HTTP endpoint is:

  • Method: GET /task
  • Query Parameters: token={token}