Pattern: Workflow worker
Claim available tasks, perform bounded work, and submit through the configured stage edge.
Claim available tasks, perform bounded work, and submit through the configured stage edge.
Outcome: Claim available tasks, perform bounded work, and submit through the configured stage edge.
annotate = project.workflow.get_stage(name="Annotate")
for task in annotate.get_tasks():
task.claim()
try:
# Perform the approved external operation here.
task.submit()
except Exception:
task.release()
raiseA real worker should bound concurrency, record task IDs, handle already-claimed work, respect role permissions, and separate retriable execution from irreversible stage actions. Do not submit merely because an external process returned successfully; validate the expected annotation or artifact first.
Execution surface
Pinned unitlab==3.0.0 application environment on Python 3.10+.
Identity
Least-privilege API key supplied through approved configuration.
Target resolution
Stable resource IDs and an explicitly bounded target set.
Success evidence
Typed return fields, server-side state, and downstream acceptance of the result.
Authentication or authorization fails
Stop, correct the service identity or access model, rotate exposed credentials, and rerun a read-only check.
Validation or entitlement rejects the operation
Correct the input or entitlement; do not retry an unchanged request.
A request times out
Inspect remote state before repeating a mutation because the server may have accepted it.
Asynchronous processing exceeds its deadline
Preserve the Batch Queue or release ID, continue bounded monitoring, and inspect item-level failures.
Only part of a batch succeeds
Keep successful identifiers, isolate failed rows, and retry only the corrected subset.
Pin and test the production SDK version. Use stable IDs, keep secrets out of logs and command history, and record the correlation ID, target IDs, counts, final state, and redacted error details for material state changes.
Continue with Unitlab: enterprise data annotation workflows