Skip to content

Add per-process array scheduling hints for Google Batch - #7395

Open
fraser-combe wants to merge 1 commit into
nextflow-io:masterfrom
fraser-combe:feat/google-batch-array-scheduling
Open

Add per-process array scheduling hints for Google Batch#7395
fraser-combe wants to merge 1 commit into
nextflow-io:masterfrom
fraser-combe:feat/google-batch-array-scheduling

Conversation

@fraser-combe

@fraser-combe fraser-combe commented Jul 27, 2026

Copy link
Copy Markdown

Summary

closes #6825

Adds two per-process array task-group scheduling hints for the Google Batch executor, exposed through the hints process directive (#7034): scheduling.policy and scheduling.parallelism. They let a pipeline control how an array process's tasks are scheduled on Batch - run sequentially on a single VM, and/or with a concurrency cap - per process, which isn't possible today. The keys follow the scheduling.* namespace convention from the hints-process-directive ADR (20260323-hints-process-directive.md); the ADR catalogs scheduling.provisioningModel (#7343) and scheduling.priority, and these two array-scheduling keys extend that same namespace.

What it adds

  • A scheduling.policy hint (a String) on the Google Batch executor, mapping to the Batch TaskGroup.SchedulingPolicy:
    • in_order > IN_ORDER: the array's tasks run sequentially by index on a single VM. Batch requires parallelism = 1 for IN_ORDER, so it is set automatically.
    • as_soon_as_possible > the default; the policy is left unset (today's behaviour).
    • values are case-insensitive and trimmed (in-order is accepted as in_order).
  • A scheduling.parallelism hint (a positive integer) that caps how many of an array's tasks run concurrently, clamped to the array size. Ignored under in_order (which pins parallelism to 1).
  • Array-only. Both hints apply only to array (TaskArrayRun) tasks. A non-array process that sets them gets a warning and no effect.
  • Strict value validation. An unknown scheduling.policy value, or a non-integer / non-positive scheduling.parallelism, throws IllegalArgumentException - no silent fallback, so a typo fails fast.
  • Unknown-key validation. An unrecognized google-batch/-prefixed hint key throws, per the ADR (unrecognized prefixed hints are errors); all unknown prefixed keys are reported together in one exception. Bare and foreign-executor keys are left untouched.
  • Resolution. Each hint resolves both the bare key (scheduling.policy) and the executor-prefixed key (google-batch/scheduling.policy); the prefixed form is prioritized. This mirrors the AWS Batch executor's existing hint resolution (get(prefix+key) ?: get(key)).
  • Fallback. When the hints are unset, task-group construction is unchanged from today.
process BIG_ARRAY {
  array 100
  hints 'scheduling.policy': 'in_order'
  // or
  hints 'scheduling.parallelism': '8'
}

Tests

Unit tests added in nf-google (GoogleBatchTaskHandlerTest):

  1. should apply array scheduling from hints - policy mapping (in_order, the in-order spelling, as_soon_as_possible), the parallelism cap, clamping to the array size, string and integer values, and the google-batch/-prefixed form.
  2. should throw on invalid array scheduling hint - an unknown policy value and a non-integer / zero / negative parallelism all throw.
  3. should accept known and unprefixed google-batch hints - null/empty maps, a known prefixed key, a bare key, and a foreign-executor key are all left untouched (no throw).
  4. should reject unknown prefixed google-batch hints - an unrecognized google-batch/-prefixed key throws, per the ADR's prefixed-error rule.

Validation

The unit tests above assert the resulting TaskGroup (schedulingPolicy and parallelism) for each case. I have not run this against a live Google Batch project yet.

Related

Add two Google Batch `hints` keys for array tasks:

- `scheduling.policy`: `in_order` sets the task group's IN_ORDER
  scheduling policy (and parallelism=1, which Batch requires), running
  the array's tasks sequentially by index on a single VM;
  `as_soon_as_possible` (the default) leaves the policy unset.
- `scheduling.parallelism`: caps the number of array tasks that run
  concurrently, clamped to the array size; ignored under `in_order`.

Both apply only to array (TaskArrayRun) tasks and preserve today's
behaviour when unset. The `google-batch/`-prefixed form takes precedence
over the bare form. Unknown `google-batch/`-prefixed hints are rejected,
per the hints ADR. Includes unit tests and docs.

Closes nextflow-io#6825

Signed-off-by: Fraser Combe <fraser.combe@tempus.com>
@fraser-combe
fraser-combe requested a review from a team as a code owner July 27, 2026 20:21
@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs ready!

Name Link
🔨 Latest commit bd6aeed
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs/deploys/6a67bdcab6d1450008f11998
😎 Deploy Preview https://deploy-preview-7395--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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: add option to change default scheduling policy with nf-google

2 participants