Skip to content

Report actual GCP zone from Batch status events#6855

Merged
bentsherman merged 3 commits intomasterfrom
gbatch-zone-from-events
Feb 25, 2026
Merged

Report actual GCP zone from Batch status events#6855
bentsherman merged 3 commits intomasterfrom
gbatch-zone-from-events

Conversation

@pditommaso
Copy link
Member

Summary

Fixes #6646

Alternative to #6854 — instead of writing a .command.zone file from inside the task, this approach resolves the actual execution zone by parsing Google Batch StatusEvent descriptions, which include the zone in the format zones/<zone>/instances/<instance-id>.

This avoids creating an additional bucket file and keeps all changes within the Google plugin (no core module changes).

Changes

  • GoogleBatchTaskHandler.groovy — On task completion, getMachineInfo() calls updateZoneFromEvents() which fetches the task status events and parses the zone from the event description using a regex. Updates CloudMachineInfo with the actual zone. Uses a volatile boolean zoneUpdated flag to ensure the API is called at most once.

Design decisions

  • Graceful degradation — If no zone is found in the events (e.g. the event descriptions don't contain zone info), the trace record falls back to the configured region as before
  • Read-once semantics — The zoneUpdated flag is set in a finally block, so even if the API call fails, we don't retry on every getMachineInfo() call
  • No core module changes — Unlike the .command.zone approach, this doesn't touch TaskRun or add new bucket files

Test plan

  • Data-driven test covering: zone from succeeded event, zone from preemption event, no zone in event, empty events
  • Null machineInfo and not-completed guards
  • Zone resolved only once across multiple getMachineInfo() calls
  • API error handled gracefully with fallback to original zone
  • All tests pass

@netlify
Copy link

netlify bot commented Feb 23, 2026

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 5034831
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/699f1b3f8d7c860008817749

@jonmarti
Copy link
Collaborator

@pditommaso awesome! closed my PR in favor to this one (no core module changes, no extra file on GCS, doesn't depend on the script launcher, ...)

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso force-pushed the gbatch-zone-from-events branch from b7943fc to d54663e Compare February 23, 2026 20:06
@bentsherman bentsherman merged commit 4657912 into master Feb 25, 2026
23 checks passed
@bentsherman bentsherman deleted the gbatch-zone-from-events branch February 25, 2026 16:21
pditommaso added a commit that referenced this pull request Feb 27, 2026
Co-authored-by: Jon Martí <jmartifraiz@gmail.com>
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.

Google Batch: Report actual zone where tasks execute in trace records

3 participants