Skip to content

Commit

Permalink
fix: CustomJob.from_local_script does not pass args to script for cus…
Browse files Browse the repository at this point in the history
…tom container images

PiperOrigin-RevId: 531282139
  • Loading branch information
jaycee-li authored and Copybara-Service committed May 11, 2023
1 parent ad7ef73 commit 6ead69d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions google/cloud/aiplatform/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,14 +1577,14 @@ def from_local_script(
+ f"python3 -m {python_packager.module_name}",
]

if args:
command[-1] += " " + " ".join(args)

spec["container_spec"] = {
"image_uri": container_uri,
"command": command,
}

if args:
spec["container_spec"]["args"] = args

if environment_variables:
spec["container_spec"]["env"] = [
{"name": key, "value": value}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/aiplatform/test_custom_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,8 @@ def test_create_from_local_script_custom_container_with_all_args(
enable_autolog=True,
)

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

0 comments on commit 6ead69d

Please sign in to comment.