Skip to content

Commit

Permalink
Merge pull request #1133 from abcdefgs0324/container_command
Browse files Browse the repository at this point in the history
fix: Set serving_container_command to entrypoint instead of command to match our requirements
  • Loading branch information
abcdefgs0324 authored Apr 4, 2022
2 parents 8c455ea + b79a507 commit 51273bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions google/cloud/aiplatform/docker_utils/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ def run_prediction_container(
raise ValueError(f'artifact_uri must be a GCS path but it is "{artifact_uri}".')
envs[prediction.AIP_STORAGE_URI] = artifact_uri if artifact_uri is not None else ""

command = (
entrypoint = (
serving_container_command[:] if serving_container_command is not None else []
)
command += serving_container_args if serving_container_args is not None else []
command = serving_container_args[:] if serving_container_args is not None else []

credential_from_adc_env = credential_path is None
credential_path = credential_path or _get_adc_environment_variable()
Expand All @@ -165,6 +165,7 @@ def run_prediction_container(
container = client.containers.run(
serving_container_image_uri,
command=command if len(command) > 0 else None,
entrypoint=entrypoint if len(entrypoint) > 0 else None,
ports={port: host_port},
environment=envs,
volumes=volumes,
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/aiplatform/test_docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_run_prediction_container(self, docker_client_mock):
docker_client_mock.containers.run.assert_called_once_with(
self.IMAGE_URI,
command=None,
entrypoint=None,
ports={prediction.DEFAULT_AIP_HTTP_PORT: None},
environment={
prediction.AIP_HTTP_PORT: prediction.DEFAULT_AIP_HTTP_PORT,
Expand Down Expand Up @@ -145,7 +146,8 @@ def test_run_prediction_container_with_all_parameters(

docker_client_mock.containers.run.assert_called_once_with(
self.IMAGE_URI,
command=serving_container_command + serving_container_args,
command=serving_container_args,
entrypoint=serving_container_command,
ports={serving_container_ports[0]: host_port},
environment=environment,
volumes=volumes,
Expand All @@ -167,6 +169,7 @@ def test_run_prediction_container_credential_from_adc(
docker_client_mock.containers.run.assert_called_once_with(
self.IMAGE_URI,
command=None,
entrypoint=None,
ports={prediction.DEFAULT_AIP_HTTP_PORT: None},
environment={
prediction.AIP_HTTP_PORT: prediction.DEFAULT_AIP_HTTP_PORT,
Expand Down

0 comments on commit 51273bc

Please sign in to comment.