Skip to content

[Test] Match managed-job GCP instances on the name prefix that survives truncation - #10809

Merged
lloyd-brown merged 1 commit into
masterfrom
lloyd/fix-gcp-managed-job-cluster-filter
Sep 17, 2026
Merged

lloyd-brown merged 1 commit into
masterfrom
lloyd/fix-gcp-managed-job-cluster-filter

Conversation

@lloyd-brown

@lloyd-brown lloyd-brown commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

test_managed_jobs_recovery_multi_node_gcp fails on every run since #10396, and test_managed_jobs_recovery_gcp / test_managed_jobs_cancellation_gcp fail whenever the jobs controller has reached job id 10. In smoke-tests 13078 the multi-node test failed 3/3 attempts after the job had reached RUNNING, at its own terminate step:

gcloud compute instances delete --zone=... --quiet $(gcloud compute instances list --filter="(labels.ray-cluster-name:t-jobs-recovery-m-42-3617 AND labels.ray-node-type=worker)" ...)
ERROR: (gcloud.compute.instances.delete) argument INSTANCE_NAMES [INSTANCE_NAMES ...]: Must be specified.

Root cause

The tests filter on labels.ray-cluster-name:<job name truncated to JOBS_CLUSTER_NAME_PREFIX_LENGTH>. The controller launches the cluster as <name>-<job_id>, and the GCP provisioner applies make_cluster_name_on_cloud with GCP's 35-char limit, which keeps only the first 35 - 2 - 1 - 9 = 23 chars of the display name and appends -<2-char hash>-<8-char user hash>. #10396 (2026-08-08) widened test_id from 2 to 4 chars, so get_cluster_name() now yields 24- to 25-char names and the display name no longer fits:

test job name cluster on GCP (job id 1) filter matches
recovery_multi_node_gcp t-jobs-recovery-m-42-abcd (25) t-jobs-recovery-m-42-ab-13-<userhash> never
recovery_gcp t-jobs-recovery-gcp-abcd (24) t-jobs-recovery-gcp-abcd-1-<userhash> only for job id < 10
cancellation_gcp t-j-cancellati-d8-abcd-3 (24) t-j-cancellati-d8-abcd-3-1-<userhash> only for job id < 10

gcloud's : operator is a word-prefix match, so ...-42-3617 can never match ...-42-36-8v-.... The GCP tests only run in release builds, and the 0.13.2rc1 run (full-smoke-tests-run 126) never reached this step because of the us-central1 N4 stockout, which is why it surfaced only now.

Fix

Add smoke_tests_utils.get_managed_job_cluster_name_prefix_on_gcp(), which mirrors the production naming (JOBS_CLUSTER_NAME_PREFIX_LENGTH, GCP.max_cluster_name_length(), CLUSTER_NAME_HASH_LENGTH, USER_HASH_LENGTH) and returns the leading 23 chars that are guaranteed to survive, and filter on that in the three GCP tests. The prefix still includes the first two chars of test_id, the same entropy the filter had before #10396. The AWS variants use a Values=<name>* wildcard and AWS has no 35-char limit, so they are unchanged.

Side note, not changed here: JOBS_CLUSTER_NAME_PREFIX_LENGTH = 25 is documented as preventing a second truncation that hides the job id, but on GCP (35-char limit with the 9-char user hash) that already happens for any name of 25 chars, so the job id is routinely absent from GCP cluster names. Cosmetic only.

Validation

🤖 Generated with Claude Code


Devin Review

…es truncation

The GCP managed-job smoke tests locate the job's VMs with
`gcloud compute instances list --filter="labels.ray-cluster-name:<name>"`,
where <name> is the job name truncated to JOBS_CLUSTER_NAME_PREFIX_LENGTH.
The controller launches the cluster as `<name>-<job_id>`, and the GCP
provisioner then applies make_cluster_name_on_cloud with GCP's 35-char
limit, which cuts the display name to 23 chars and appends
`-<2-char hash>-<8-char user hash>`. Since #10396 widened test_id to four
chars, get_cluster_name() yields 24- to 25-char names, so the job id and
the tail of the name are cut off and the `:` (word-prefix) filter never
matches. The `gcloud compute instances delete $(...)` then runs with no
instance and exits 2:

  test_managed_jobs_recovery_multi_node_gcp: name 't-jobs-recovery-m-42-3617'
  (25 chars) -> cluster 't-jobs-recovery-m-42-36-8v-2cf7a762'. Fails on
  every run. Seen in smoke-tests build 13078 (3/3 attempts) after the job
  had reached RUNNING.
  test_managed_jobs_recovery_gcp / test_managed_jobs_cancellation_gcp:
  24-char names fit for single-digit job ids and break once the controller
  reaches job id 10.

Add smoke_tests_utils.get_managed_job_cluster_name_prefix_on_gcp(), which
mirrors the production naming and returns the leading
35 - 2 - 1 - 9 = 23 chars of the display name (computed from the library
constants), and filter on that in the three GCP tests. The prefix still
carries the first two chars of test_id, the same entropy the filter had
before #10396. AWS tests already use a `Values=<name>*` wildcard and AWS
has no 35-char limit, so they are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@lloyd-brown

Copy link
Copy Markdown
Collaborator Author

/smoke-test --gcp -k "test_managed_jobs_recovery_gcp or test_managed_jobs_cancellation_gcp"

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@lloyd-brown

Copy link
Copy Markdown
Collaborator Author

Validation

Build Branch Test Result
13083 this PR test_managed_jobs_recovery_gcp (us-east4-b) passed
13083 this PR test_managed_jobs_cancellation_gcp (us-west3-b) passed
13084 #10807 with this commit applied (test moved to us-east1-b because us-central1 is stocked out) test_managed_jobs_recovery_multi_node_gcp passed, first attempt

Before the fix the multi-node test failed 3/3 attempts in 13078 at the terminate step with the job already RUNNING. Also confirmed against a live instance that gcloud's : operator on label values is a string-prefix match (labels.ray-cluster-name:sam2-ste matches sam2-step2-4a518514), so the 23-char prefix matches both truncated and untruncated cluster names.

@lloyd-brown
lloyd-brown enabled auto-merge (squash) September 17, 2026 20:46
@lloyd-brown
lloyd-brown merged commit 6806ec6 into master Sep 17, 2026
23 checks passed
@lloyd-brown
lloyd-brown deleted the lloyd/fix-gcp-managed-job-cluster-filter branch September 17, 2026 20:47
@zpoint zpoint mentioned this pull request Oct 19, 2026
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