Repository navigation
fix(job/pathways): pass --sidecar_name=external to pathways-proxy when the colocated Python sidecar is enabled - #6593
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request ensures that when a colocated Python sidecar is enabled for Pathways jobs, the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request automatically appends the --sidecar_name=external argument to the pathways-proxy container when the colocated Python sidecar is enabled, ensuring that Pathways routes colocated Python work to the sidecar. It preserves any user-defined --sidecar_name passed via --pathways-proxy-args to avoid duplication. The changes include updates to the documentation, implementation of the argument-appending logic in the GKE manifest generator, and comprehensive unit tests validating the behavior under various configurations. The implementation is clean, well-tested, and I have no additional feedback to provide.
Neelabh94
left a comment
There was a problem hiding this comment.
Nice work! The automatic injection of --sidecar_name=external aligns with upstream pathways-utils golden YAMLs (isc_pathways.py) and the Cloud Pathways proxy_server binary contract, ensuring colocated Python calls are properly routed to the worker sidecars without requiring manual proxy flag configuration.
A few recommendations to improve code simplicity, test coverage, and documentation consistency:
-
Code Simplification / YAGNI (
pkg/orchestrator/gke/manifest_generator.go:684, 783):
withSidecarNameArghas a single call site and currently takes asidecarEnabled boolparameter just to return early when false. We can simplify both the helper signature and its unit tests by guarding directly at the call site:// pkg/orchestrator/gke/manifest_generator.go:684 if opts.Pathways.ColocatedPythonSidecarImage != "" { proxyArgsList = withSidecarNameArg(proxyArgsList) }
// pkg/orchestrator/gke/manifest_generator.go:783 func withSidecarNameArg(proxyArgs []string) []string { for _, arg := range proxyArgs { name := strings.TrimLeft(arg, "-") if name == "sidecar_name" || strings.HasPrefix(name, "sidecar_name=") { return proxyArgs } } return append(proxyArgs, "--sidecar_name=external") }
-
Test Coverage Additions (
pkg/orchestrator/gke/manifest_generator_test.go):- In
TestWithSidecarNameArg, consider adding test cases for:nil/ empty slice (args: nil,args: []string{})- Empty assignment (
--sidecar_name=) - Multiple unrelated flags (
[]string{"--foo=1", "--bar=2"})
- In
TestGeneratePathwaysManifest_SidecarNameArg, add the negative headless case to verify the flag is omitted when no sidecar image is specified:{name: "headless no sidecar", headless: true, wantArg: false}, - In
TestGeneratePathwaysManifest_SidecarNameArgUserValue, test space-separated format (--sidecar_name custom) through--pathways-proxy-argsto verifystrings.Fieldsintegration end-to-end.
- In
-
CLI Help Text (
cmd/job/submit.go:193):- The documentation in
docs/gcluster_job_guide.mdwas updated, but the flag description incmd/job/submit.gostill has the older text. Consider updating theSubmitCmd.Flags().StringVardescription to mention that--sidecar_name=externalis automatically passed topathways-proxysogcluster job submit --helpstays aligned with the guide.
- The documentation in
…n the colocated Python sidecar is enabled Without --sidecar_name, pathways-proxy does not set up the sidecar connection on the workers, so colocated Python work never reaches the sidecar started by --pathways-colocated-python-sidecar-image. A --sidecar_name already passed via --pathways-proxy-args is kept.
- withSidecarNameArg takes only the proxy args; the caller checks the sidecar image. - Add tests for headless without a sidecar, nil args, an empty --sidecar_name=, and a space-separated --sidecar_name passed through --pathways-proxy-args.
58d1a56 to
8536e9a
Compare
|
Thanks! addressed in 8536e9a:
|
d6688fa
into
GoogleCloudPlatform:develop
Summary
When
--pathways-colocated-python-sidecar-imageis set, gcluster starts the colocated Python sidecar in each worker pod but never toldpathways-proxyto use it. Without--sidecar_name, the proxy doesn't set up the sidecar connection on the workers, so colocated Python work never reaches the sidecar.This matches the Cloud Pathways team's sidecar/MTC configurations and XPK usage (confirmed with the Pathways team).
Changes
--sidecar_name=externalto thepathways-proxyargs when the colocated Python sidecar is enabled (batch and headless). A--sidecar_namealready passed via--pathways-proxy-argsis kept and not duplicated.--pathways-colocated-python-sidecar-imagerow in the job guide.The flag is added through the existing proxy args list, so
pathways_jobset.tmplis unchanged and custom templates pick it up without re-extracting.Compatibility
No new flags. Only jobs using
--pathways-colocated-python-sidecar-imageare affected,and their sidecar is now actually used. Proxy images too old to recognize
--sidecar_namewould reject the flag; current images support it.
Testing
--sidecar_name)and for the generated manifest (batch, headless, no sidecar, user value via
--pathways-proxy-args).2x4cluster with--pathways-colocated-python-sidecar-image: the proxyregisters
colocated_python(port=50051), and workers log "External sidecar connectedto backing GRPC sidecar at localhost:50051".
go test ./pkg/orchestrator/gke/... ./cmd/job/...passes.Submission Checklist
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.