Skip to content

Drop WorkflowId.namespace, introduce WorkflowGroup#901

Merged
SimonHeybrock merged 6 commits into
mainfrom
schemas-stage0
May 1, 2026
Merged

Drop WorkflowId.namespace, introduce WorkflowGroup#901
SimonHeybrock merged 6 commits into
mainfrom
schemas-stage0

Conversation

@SimonHeybrock
Copy link
Copy Markdown
Member

@SimonHeybrock SimonHeybrock commented Apr 29, 2026

Summary

Reduces WorkflowId identity from (instrument, namespace, name, version) to (instrument, name, version) and replaces the namespace field with a display-oriented WorkflowGroup.

Why

WorkflowSpec.namespace was carrying three unrelated responsibilities: workflow identity, the routing key JobFactory used to accept/reject jobs, and the dashboard's display category. Splitting them:

  • Routing now uses an explicit service tag tracked by WorkflowFactory, consulted via get_service(workflow_id). The service's own name is the comparison key, no longer read from WorkflowId.
  • Display grouping becomes a typed WorkflowGroup with canonical REDUCTION / MONITORS / DETECTORS / TIMESERIES constants and a Literal-locked name to keep ad-hoc categories from sneaking in.
  • Identity drops the field entirely; WorkflowId strings are now 3-part (instrument/name/version).

With the awkward semantics gone, the upcoming move into ess.livedata.schemas becomes mechanical.

Note

  • No wire-format compatibility. JobStatusPayload workflow-id strings, ResultKey JSON, and persisted configs all pick up the 3-part form.

WorkflowFactory tracks the backend service name for each registered spec,
defaulting to the spec's namespace. JobFactory consults this tag via
get_service() instead of comparing workflow_id.namespace against
Instrument.active_namespace.

service_name is threaded from DataServiceBuilder through
OrchestratingProcessor into JobFactory, and is also the single source for
the service heartbeat's namespace field (wire format unchanged here;
renamed in 0b). The dead Instrument.active_namespace write in
DataServiceBuilder is removed. The field itself stays on Instrument until
0e so tests referencing it remain valid.

Stage 0a of docs/developer/plans/ess-livedata-schemas-stage0.md.
The field was overloaded: identity-for-worker-routing in the dashboard
plus display label in the backend status widget. Both uses describe the
backend service, not a namespace. Renaming across ServiceStatus (domain
type), ServiceStatusPayload (wire payload), and ServiceServiceId (the
`:`-separated service_id) makes the semantics explicit.

The service_id wire string format (`instrument:<middle>:worker_id`) is
unchanged — the middle segment still carries the service name, just
sourced from .service_name now.

BackendStatusWidget's "Namespace" column becomes "Service"; internal
pane + width constants renamed to match.

Stage 0b of docs/developer/plans/ess-livedata-schemas-stage0.md.
Stage 0d of ess-livedata-schemas: introduces a `WorkflowGroup` pydantic
model (frozen, `Literal`-constrained name) with canonical module-level
constants `REDUCTION`, `MONITORS`, `DETECTORS`, `TIMESERIES`. Adds a
required `group: WorkflowGroup` field to `WorkflowSpec` so display
metadata travels alongside the spec.

`Instrument.register_spec` and `Instrument.add_logical_view` now take a
`group=` argument in place of `namespace=`, deriving the legacy
`WorkflowSpec.namespace` value from `group.name` until 0e drops it.

Omits the `params`→`inputs` rename from the plan; not strictly necessary
at this point.
Stage 0e of ess-livedata-schemas. `WorkflowId` identity becomes
`(instrument, name, version)` and `WorkflowSpec.namespace` is removed;
`group` (added in 0d) now carries the display category and, by default,
the service tag. `WorkflowId.__str__`/`from_string` use the 3-part
`instrument/name/version` form. `Instrument.active_namespace` (unused
since 0a) is removed.

The dashboard plot-config modal switches its workflow grouping from
`workflow_id.namespace` to `spec.group.name`/`spec.group.title`, with
the synthetic static-overlay sentinel renamed accordingly.

No wire-format compatibility — JobStatusPayload workflow_id strings,
ResultKey JSON, and persisted configs all pick up the 3-part form.
@SimonHeybrock SimonHeybrock changed the title Stage 0: drop WorkflowId.namespace, introduce WorkflowGroup Drop WorkflowId.namespace, introduce WorkflowGroup Apr 29, 2026
@SimonHeybrock SimonHeybrock marked this pull request as ready for review April 29, 2026 09:41
@SimonHeybrock SimonHeybrock requested a review from jl-wynen April 29, 2026 09:42
Copy link
Copy Markdown
Member

@jl-wynen jl-wynen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to split display grouping and job assignment.
Can you remind me what a 'service' is exactly?

Is it safe to drop the 'namespace' / 'service' from WorkflowId? Or can there be clashes now?

Comment thread src/ess/livedata/config/instrument.py Outdated
group:
Display-oriented :class:`WorkflowGroup` this view belongs to.
The group's ``name`` (e.g. ``'detector_data'`` or ``'monitor_data'``)
also determines which service runs the workflow today.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing service.

Comment thread src/ess/livedata/config/instrument.py Outdated
service:
Name of the backend service responsible for running this workflow.
Defaults to ``group.name`` (service and group identifier match
today; the coupling is removed in a later stage).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(service and group identifier match today; the coupling is removed in a later stage)

This doesn't sound like an explanation for a user but a commit/PR comment.

Is it correct that currently service == group.name everywhere?

@SimonHeybrock
Copy link
Copy Markdown
Member Author

I think it makes sense to split display grouping and job assignment. Can you remind me what a 'service' is exactly?

Backend is split into shards ("services"), handling different subsets of workflows.

Is it safe to drop the 'namespace' / 'service' from WorkflowId? Or can there be clashes now?

Did check for clashing during this work and found none. Option for clashes existed even before, now we simply have a larger set of workflows that need unique names.

- Add missing `service` parameter doc to `add_logical_view`
- Remove temporal "today; the coupling is removed in a later stage"
  language from `service` param docs in both `instrument.py` and
  `workflow_factory.py`
@SimonHeybrock SimonHeybrock requested a review from jl-wynen April 29, 2026 12:38
Copy link
Copy Markdown
Member

@jl-wynen jl-wynen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to split display grouping and job assignment.
Can you remind me what a 'service' is exactly?

Is it safe to drop the 'namespace' / 'service' from WorkflowId? Or can there be clashes now?

@SimonHeybrock SimonHeybrock enabled auto-merge April 30, 2026 07:20
@SimonHeybrock SimonHeybrock disabled auto-merge April 30, 2026 07:20
@SimonHeybrock SimonHeybrock enabled auto-merge May 1, 2026 05:08
@SimonHeybrock SimonHeybrock merged commit b6bb1e8 into main May 1, 2026
13 checks passed
@SimonHeybrock SimonHeybrock deleted the schemas-stage0 branch May 1, 2026 05:13
MridulS pushed a commit that referenced this pull request May 11, 2026
PR #901 dropped the namespace segment from WorkflowId. Existing dashboard
config YAMLs still hold 4-part IDs; this script rewrites them to the new
3-part form, with .bak backups and atomic writes. Idempotent.
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.

2 participants