Skip to content

Filter autoLabels to selected workflow-metadata fields#7049

Merged
pditommaso merged 17 commits intomasterfrom
feat/seqera-auto-labels-filter
Apr 20, 2026
Merged

Filter autoLabels to selected workflow-metadata fields#7049
pditommaso merged 17 commits intomasterfrom
feat/seqera-auto-labels-filter

Conversation

@pditommaso
Copy link
Copy Markdown
Member

Summary

Extends seqera.executor.autoLabels so users can pick which workflow-metadata labels are attached to a run, instead of the prior all-or-nothing boolean.

Stacked on top of #7048 (base branch: feat/seqera-resource-labels). Merge that one first.

Config shape

seqera.executor.autoLabels now accepts any of:

  • true — emit all 11 default labels (current behaviour, back-compatible).
  • false / null / empty list / empty string — disable (default).
  • List<String> — e.g. ['runName', 'projectName'].
  • String — comma-separated form, e.g. 'runName,projectName'. Whitespace around tokens is trimmed; leading/trailing spaces in list entries are trimmed as well.

Valid short names (11 total):

projectName, userName, runName, sessionId, resume,
revision, commitId, repository, manifestName, runtimeVersion, workflowId

Each maps internally to nextflow.io/<name> except workflowId which maps to seqera.io/platform/workflowId.

Unknown names fail fast at config parse time with a clear error listing the valid values:

Invalid 'seqera.executor.autoLabels' name(s) [foo] - valid names are: projectName, userName, runName, ...

Changes

plugins/nf-seqera/src/main/io/seqera/config/ExecutorOpts.groovy

  • New static final Set<String> VALID_AUTO_LABELS constant (11 names).
  • autoLabels field widens from boolean to Set<String>; getter signature likewise.
  • New protected static Set<String> parseAutoLabels(Object value) normalises every accepted input form and trims whitespace on both the CharSequence (post-tokenize) and List paths.
  • @Description updated to document the new forms and the valid names.

plugins/nf-seqera/src/main/io/seqera/executor/Labels.groovy

  • New static final Set<String> ALL_AUTO_LABELS constant.
  • Existing withWorkflowMetadata(WorkflowMetadata) becomes a thin delegate to a new 2-arg overload withWorkflowMetadata(WorkflowMetadata, Set<String> include).
  • The 2-arg form gates each entries.put(...) on include.contains('<shortName>').

plugins/nf-seqera/src/main/io/seqera/executor/SeqeraExecutor.groovy

  • createRun() now passes seqeraConfig.autoLabels to the filtered overload. The gate if( seqeraConfig.autoLabels ) still works: an empty Set is Groovy-falsy, a non-empty Set is truthy.

Tests

  • ExecutorOptsTest — one existing test rewritten ('should enable auto labels''should enable all auto labels when set to true') + 8 new tests covering every input path: explicit false, list, comma-string, comma-string with whitespace, list entries with whitespace, empty list, empty string, unknown name rejection.
  • LabelsTest — 3 new filter tests (include subset, workflowId-only, empty-set emits nothing).

Test plan

  • ./gradlew :plugins:nf-seqera:test — green (180 tests)
  • CI re-run after stacked-PR merge ordering is confirmed
  • Smoke run with:
    seqera.executor.autoLabels = ['runName', 'workflowId']
    and verify only those two labels land on the Sched run.

Notes

  • No plugin version bump in this commit — will be handled together with Honour process.resourceLabels in nf-seqera executor #7048 at release time.
  • ExecutorOpts.VALID_AUTO_LABELS and Labels.ALL_AUTO_LABELS are intentionally separate constants (config-layer validation vs label-emission concern). They are identical today; a future label addition must update both. Worth a guard test if this ever drifts.

pditommaso and others added 16 commits April 17, 2026 20:07
Spec for honouring process.resourceLabels in nf-seqera with cumulative
semantics: config-level baseline on the Sched run, per-task delta on
Sched task. Removes the now-redundant seqera.executor.labels option.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Task-by-task TDD plan implementing the spec from
docs/superpowers/specs/2026-04-17-seqera-resource-labels-design.md.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
…ess.resourceLabels

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Picks up the published artifact so the build resolves without the
includeBuild composite. The transitive sched-api 0.52.0-SNAPSHOT is
now also published.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
- Labels.toStringMap now accepts Object and throws IllegalArgumentException
  when the value is not a Map, giving a clear error when
  process.resourceLabels is misconfigured (e.g. as a list).
- SeqeraExecutor.getRunResourceLabels wraps the cached map in
  Collections.unmodifiableMap, matching Labels.getEntries.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
…ds [ci fast]

Widen seqera.executor.autoLabels to accept a list or comma-separated
string of short names (e.g. ['runName','projectName']) in addition to
true/false. Valid names: projectName, userName, runName, sessionId,
resume, revision, commitId, repository, manifestName, runtimeVersion,
workflowId. Unknown names throw IllegalArgumentException at config
parse time. true still emits all labels; false/null/empty remain
disabled.

Labels.withWorkflowMetadata gains a 2-arg overload that filters by the
given include set; the single-arg form delegates with the full set so
existing call sites and tests are unchanged.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso requested a review from bentsherman April 19, 2026 13:34
Base automatically changed from feat/seqera-resource-labels to master April 20, 2026 16:46
@pditommaso pditommaso requested a review from a team as a code owner April 20, 2026 16:46
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 20, 2026

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 6b3d007
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69e65a10eefd6f000882de2b

@pditommaso pditommaso merged commit ddc974f into master Apr 20, 2026
11 checks passed
@pditommaso pditommaso deleted the feat/seqera-auto-labels-filter branch April 20, 2026 17:13
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