Add scheduling.provisioningModel per-process hint for Google Batch#7343
Open
reece-maticebio wants to merge 1 commit into
Open
Add scheduling.provisioningModel per-process hint for Google Batch#7343reece-maticebio wants to merge 1 commit into
reece-maticebio wants to merge 1 commit into
Conversation
Implements the Google Batch entry from the hints-process-directive ADR (adr/20260323-hints-process-directive.md) / issue nextflow-io#3530 using the generic `scheduling.` hint namespace agreed in the ADR, rather than a narrow executor-specific key. The `scheduling.provisioningModel` hint selects the Google Batch ProvisioningModel for a single process, overriding the global `google.batch.spot` / `google.batch.preemptible` config. The value is a case-insensitive, trimmed string: `spot` -> SPOT, `standard` (or its alias `ondemand`) -> STANDARD (on-demand), `preemptible` -> PREEMPTIBLE. Any other value throws IllegalArgumentException (strict, no fail-open). The executor-prefixed form `google-batch/scheduling.provisioningModel` takes precedence over the bare form, mirroring how the AWS Batch executor resolves its `consumableResources` hint; when unset, the global config is used. Hint-key validation and provisioning-model resolution are separated so each has one clear responsibility: - validateHints() runs exactly ONCE per task submission, at the top of newSubmitRequest() (before the instance-policy and machine-type work). It strictly validates only `google-batch/`-prefixed keys: any unrecognized prefixed hints throw IllegalArgumentException, per the ADR (unknown *prefixed* hints are errors) and matching the Seqera executor's HintHelper. All unknown prefixed keys are collected and reported together in a single exception (better debugging UX -- see them all at once) rather than throwing on the first one. Bare and foreign-executor keys are left untouched. (AWS Batch currently only warns -- a known divergence.) It returns early on null/empty hints. - resolveProvisioningModel() is now a PURE resolver: it only reads the hint value and maps it to the effective ProvisioningModel (else global config, where spot wins over preemptible, default STANDARD). It no longer key-validates, so it never throws on unknown keys -- only on a bad *value*. It is called from both the instance-policy call site and machine-type selection without redundant re-validation. `standard` is Google's canonical enum term; `ondemand` (the AWS/Seqera term) is accepted as an alias resolving to the same STANDARD model. - Instance-policy call site sets the resolved model; STANDARD is left unset so the Batch default (on-demand) applies. - Machine-type/price selection prices as spot when the resolved model is SPOT or PREEMPTIBLE, standard otherwise. - On the instance-template (`template://`) path, the whole instance policy is replaced by the template, so the `scheduling.provisioningModel` hint has no effect there -- warn when it is set, mirroring the existing per-setting `google.batch.spot` / `preemptible` template warnings. The warning is hardcoded for this hint (not auto-scanned over KNOWN_HINTS): whether a template overrides a hint is a per-hint decision, so a future job-level hint would be evaluated separately. - Unit tests + docs (executor.md Google Batch hints). Value tests target resolveProvisioningModel(); key tests target validateHints() directly. Signed-off-by: Maurice Buckner-Wolfson <mbucknerwolfson@animate.bio>
✅ Deploy Preview for nextflow-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
reece-maticebio
marked this pull request as draft
July 16, 2026 18:21
reece-maticebio
marked this pull request as ready for review
July 16, 2026 18:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
closes #3530
Implements the
scheduling.provisioningModelhint from the accepted hints-process-directive ADR(
20260323-hints-process-directive.md) for the Google Batch executor, resolving #3530. It lets apipeline choose spot / on-demand / preemptible provisioning per process (rather than only globally
via
google.batch.spot), through thehintsdirective.What it adds
scheduling.provisioningModelhint (aString) on the Google Batch executor, mapping to theGoogle Batch
ProvisioningModelenum:spot→SPOTstandard(alias:ondemand) →STANDARDpreemptible→PREEMPTIBLEIllegalArgumentException— no silent fallback to adefault, so a typo fails fast instead of quietly running on the wrong provisioning model.
google-batch/-prefixed hint key throws, per the ADR(unrecognized prefixed hints are errors), matching the Seqera executor. Bare and foreign-executor
keys are left untouched.
scheduling.provisioningModel) and theexecutor-prefixed key (
google-batch/scheduling.provisioningModel); the prefixed form is prioritized. Thismirrors the AWS Batch executor's existing hint resolution (
get(prefix+key) ?: get(key)).(
google.batch.spot→ spot,google.batch.preemptible→ preemptible, else on-demand).STANDARDis applied by omitting the field so Batch's on-demand default takes effect. Pricing selection
(
PriceModel.spot) is derived from the resolved model so cost estimation stays consistent.Tests
Unit tests added in nf-google:
should resolve provisioning model from scheduling.provisioningModel hintcovers/STANDARD/PREEMPTIBLE`google-batch/-prefixed form, prefixed-wins precedence,ondemandalias, and the unset global-fallback rowsshould fail on invalid scheduling.provisioningModel hint valueshould throw on unknown google-batch prefixed hintgoogle-batch/-prefixed key (a realistic case-typo and a wholly unknown key) throws, per the ADR's prefixed-error rule.should report all unknown google-batch hints togethershould ignore unknown bare and foreign-executor hintsawsbatch/…) key are left untouched (no throw), since an executor only validates its own prefixed keys.should use instance template and ignore the provisioningModel hinttemplate://machine type with the hint set still submits successfully with the template honored (the hint is a no-op under an instance template, which replaces the instance spec wholesale).Validation on real Google Batch
Exercised against a live Google Batch project:
spot→ VM provisionedSPOTstandardandondemand→STANDARD(on-demand)preemptible→PREEMPTIBLEgoogle.batch.*settingDesign Questions
A few points came up while I was working on this:
scheduling.provisioningModel(what this PR implements), butthe Seqera executor shipped
machineRequirement.provisioning(via itsSchemaMapperUtil.toProvisioningModel). I followed the ADR.standard; AWS and Seqera useondemand(Seqera also has
spotFirst). This PR accepts bothstandardandondemand.google-batch/*keys throw here (ADR line 114;matches Seqera). The AWS Batch executor currently only warns for unknown
awsbatch/*keys, so thetwo Batch executors differ on this.
hintsnow has three specific consumers: AWS Batch(
awsbatch/consumableResources), this Google impl (sameget(prefix+key) ?: get(key)+warnUnknownHintspattern), and Seqera'sHintHelper, which already generalizes prefix/namespaceresolution behind
extractSeqeraHints(). AWS and Google duplicate whatHintHelperdoes. I'd love to takethis on as a separate PR is deemed worthwhile. I kept it out here to stay scoped to Google Batch spot enabled configuration for processes #3530.