Skip to content

Workflow Attributes#440

Merged
devhawk merged 11 commits into
mainfrom
devhawk/wf-attributes
Jun 18, 2026
Merged

Workflow Attributes#440
devhawk merged 11 commits into
mainfrom
devhawk/wf-attributes

Conversation

@devhawk

@devhawk devhawk commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Adds the ability for workflows to carry an arbitrary, JSON-serializable Map<String, Object> of custom attributes, recorded in the workflow status at creation, updatable afterward, and searchable via listWorkflows.

API

Set at creation — withAttributes(Map<String, Object>) added to every entry point:

  • WorkflowOptions (context block: try (new WorkflowOptions().withAttributes(...).setContext()) { ... })
  • StartWorkflowOptions
  • DBOSClient.EnqueueOptions
  • DebouncerClient / Debouncer

Filter — ListWorkflowsInput.withAttributes(Map) matches workflows whose attributes contain all the given pairs (Postgres @> containment, served by a GIN index).

Update after creation:

  • DBOS.updateWorkflowAttributes(workflowId, attributes) — recorded as a step (DBOS.updateWorkflowAttributes) so it's exactly-once under recovery when called from within a workflow.
  • DBOSClient.updateWorkflowAttributes(workflowId, attributes) — direct, for out-of-process use.
  • Passing null (or an empty map) clears all attributes.

Other changes

  • Scheduler startup fast-poll: polls schedules every 1s for the first 60s after launch so schedules registered around startup are picked up promptly; a ReentrantLock prevents the fast-path and regular polls from overlapping (Java-specific; py-transact's loop is single-threaded).
  • Conductor ListQueuedWorkflowsRequest fix: now declares and forwards the attributes filter (previously hardcoded null)

fixes #434

@devhawk devhawk requested review from kraftp, maxdml and qianl15 June 17, 2026 21:51
@devhawk devhawk merged commit 9abafe7 into main Jun 18, 2026
18 checks passed
@devhawk devhawk deleted the devhawk/wf-attributes branch June 18, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom Workflow Attributes

2 participants