Skip to content

Add seqera.executor.machineRequirement.onDemandCostRatio option - #7710

Merged
bentsherman merged 7 commits into
masterfrom
feat/seqera-ondemand-cost-ratio
Sep 30, 2026
Merged

bentsherman merged 7 commits into
masterfrom
feat/seqera-ondemand-cost-ratio

Conversation

@pditommaso

@pditommaso pditommaso commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds support for the Seqera executor's cost limit on the spot → on-demand fallback. It can be set for the whole run in config, or per process with a hint, just like provisioning. The scheduler side is seqeralabs/sched#1400 (run level) and seqeralabs/sched#1491 (per task).

With provisioning = 'spotFirst', the scheduler falls back to on-demand when spot capacity runs out, but only while the highest on-demand hourly price of the instance types it selected is at most a set multiple of their highest spot price. Otherwise it retries the task on spot, and the task fails if spot capacity stays unavailable, with an error starting on-demand fallback refused. The scheduler applies a default per cloud provider (currently AWS 3.25, Google Cloud 2.48, Azure no limit).

The config value is the default for every task of the run:

seqera {
    executor {
        machineRequirement {
            provisioning = 'spotFirst'
            onDemandCostRatio = 2.5
        }
    }
}

A process hint overrides it for that process:

process align {
    hints 'seqera/machineRequirement.onDemandCostRatio': 0
    ...
}
onDemandCostRatio Behaviour
not set the scheduler's default for the cloud provider applies
0 no limit: tasks always fall back to on-demand, whatever the price. It does not disable the fallback; use provisioning = 'spot' for that
> 0 this limit, used instead of the default

Tasks with different limits run on separate clusters. Tasks that set a limit, 0 included, don't use the compute environment's warm pool. For now this is the only way to set the ratio: Seqera Platform has no compute-environment setting for it.

Changes

  • MachineRequirementOpts: new onDemandCostRatio (Double) config option. As a @ConfigOption field it is automatically a supported machineRequirement.* hint, merged over the config value like the other fields.
  • SchemaMapperUtil: sends the ratio on the run's machine requirement (the run default) and on each task's (config value or hint). A shared toOnDemandCostRatio helper checks for null rather than truthiness, so an explicit 0 is sent and not dropped, and a negative value fails with a clear error.
  • Docs: a new entry in reference/config/seqera.mdx. In executor/seqera.mdx, the hint is added to the supported list, plus an "On-demand fallback cost limit" section with the config and hint examples, the unset/0/> 0 table and the cluster/warm-pool notes.
  • Dependencies: sched-client 0.79.3 → 0.96.0, and the shared libHttpxVersion 2.7.0 → 2.7.1 to stay in step with the version sched-client is built against (2.7.1 is a bug-fix release: token-refresh client leak).

Before merging

  • seqeralabs/sched#1491 merged (29 Sep). The per-process hint takes effect once that is deployed; the config option already works. Dev deploys from master; prod needs the next sched release.
  • Replace sched-client:0.96.0-SNAPSHOT with the first sched release that includes seqeralabs/sched#1400. The per-task change needs no new client, because the field is already on the shared MachineRequirement type.

Tests

  • MapperUtilTest: unset / 0 / 2.5 are mapped correctly for both the run and the task requirement, and a negative value is rejected.
  • HintHelperTest: a hint of 0 overrides a config value of 3.25 (0 is a real value, not "unset").
  • nf-seqera: all 260 tests pass against the published sched-client:0.96.0-SNAPSHOT (0.96.0-20260929.120116-9), which includes seqeralabs/sched#1400 and Limit on run name length #1491. With the sched-client 0.96.0 release and lib-httpx 2.7.1: nf-seqera 255, nf-tower 430 and nf-commons proxy tests pass.

Related: seqeralabs/sched#1400, seqeralabs/sched#1491, seqeralabs/docs#1913

🤖 Generated with Claude Code

sched-client 0.96.0 is built against lib-httpx 2.7.1, and nf-seqera keeps
the single lib-httpx declaration in step with it.

Assisted-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Set the run's cost limit on the spot to on-demand fallback (spotFirst
only). Unset keeps the scheduler's per-cloud default, 0 removes the
limit, and a positive value replaces the default. The scheduler reads the
ratio at run level only, so it is sent on run creation and rejected as a
process hint. Requires a sched-client that includes seqeralabs/sched#1400.

Assisted-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Temporary until sched publishes the release that includes
seqeralabs/sched#1400.

Assisted-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for nextflow-docs ready!

Name Link
🔨 Latest commit 21ea2bd
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs/deploys/6abd4f3e0162d100088245e2
😎 Deploy Preview https://deploy-preview-7710--nextflow-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

The scheduler now resolves the ratio per task, like provisioning: the
config value is the run default and the
seqera/machineRequirement.onDemandCostRatio hint overrides it for a
process. Send it on each task's machine requirement and stop rejecting
the hint.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Assisted-by: Claude Code (Claude Opus 5.5)
@pditommaso
pditommaso force-pushed the feat/seqera-ondemand-cost-ratio branch from 6d73a31 to 48ab6b3 Compare September 29, 2026 12:02
@pditommaso
pditommaso marked this pull request as ready for review September 29, 2026 12:05
@pditommaso
pditommaso requested a review from a team as a code owner September 29, 2026 12:05
Comment thread docs/executor/seqera.mdx Outdated
Comment thread docs/reference/config/seqera.mdx Outdated
pditommaso and others added 2 commits September 30, 2026 10:05
Co-authored-by: Chris Hakkaart <chris.hakkaart@seqera.io>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Chris Hakkaart <chris.hakkaart@seqera.io>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@bentsherman
bentsherman merged commit 5272797 into master Sep 30, 2026
25 checks passed
@bentsherman
bentsherman deleted the feat/seqera-ondemand-cost-ratio branch September 30, 2026 18:38
pditommaso added a commit that referenced this pull request Oct 6, 2026
Replace the 0.96.0-SNAPSHOT dependency with the released 0.100.0, which
includes MachineRequirement.onDemandCostRatio (#7710) and per-attempt
startedAt (#7755), and is built against lib-httpx 2.7.1.

Assisted-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
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.

3 participants