Skip to content

Commit 6ead69d

Browse files
jaycee-licopybara-github
authored andcommitted
fix: CustomJob.from_local_script does not pass args to script for custom container images
PiperOrigin-RevId: 531282139
1 parent ad7ef73 commit 6ead69d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

google/cloud/aiplatform/jobs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1577,14 +1577,14 @@ def from_local_script(
15771577
+ f"python3 -m {python_packager.module_name}",
15781578
]
15791579

1580+
if args:
1581+
command[-1] += " " + " ".join(args)
1582+
15801583
spec["container_spec"] = {
15811584
"image_uri": container_uri,
15821585
"command": command,
15831586
}
15841587

1585-
if args:
1586-
spec["container_spec"]["args"] = args
1587-
15881588
if environment_variables:
15891589
spec["container_spec"]["env"] = [
15901590
{"name": key, "value": value}

tests/unit/aiplatform/test_custom_job.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ def test_create_from_local_script_custom_container_with_all_args(
937937
enable_autolog=True,
938938
)
939939

940-
expected_container_spec = _TEST_CONTAINER_SPEC
941-
expected_container_spec.args = _TEST_RUN_ARGS
940+
expected_container_spec = copy.deepcopy(_TEST_CONTAINER_SPEC)
941+
expected_container_spec.command[-1] += " " + " ".join(_TEST_RUN_ARGS)
942942
expected_container_spec.env = [
943943
{"name": key, "value": value}
944944
for key, value in test_constants.TrainingJobConstants._TEST_ENVIRONMENT_VARIABLES.items()

0 commit comments

Comments
 (0)