Skip to content

Commit

Permalink
Fix docker image not pulled with --image option (#3614)
Browse files Browse the repository at this point in the history
  • Loading branch information
edingroot authored May 30, 2023
1 parent 7a7d540 commit 90678ed
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions paasta_tools/cli/cmds/spark_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,25 +513,33 @@ def get_docker_run_cmd(
def get_docker_image(
args: argparse.Namespace, instance_config: InstanceConfig
) -> Optional[str]:
"""
Since the Docker image digest used to launch the Spark cluster is obtained by inspecting local
Docker images, we need to ensure that the Docker image exists locally or is pulled in all scenarios.
"""
# docker image is built locally then pushed
if args.build:
return build_and_push_docker_image(args)

docker_url = ""
if args.image:
return args.image
docker_url = args.image
else:
try:
docker_url = instance_config.get_docker_url()
except NoDockerImageError:
print(
PaastaColors.red(
"Error: No sha has been marked for deployment for the %s deploy group.\n"
"Please ensure this service has either run through a jenkins pipeline "
"or paasta mark-for-deployment has been run for %s\n"
% (instance_config.get_deploy_group(), args.service)
),
sep="",
file=sys.stderr,
)
return None

try:
docker_url = instance_config.get_docker_url()
except NoDockerImageError:
print(
PaastaColors.red(
"Error: No sha has been marked for deployment for the %s deploy group.\n"
"Please ensure this service has either run through a jenkins pipeline "
"or paasta mark-for-deployment has been run for %s\n"
% (instance_config.get_deploy_group(), args.service)
),
sep="",
file=sys.stderr,
)
return None
print(
"Please wait while the image (%s) is pulled (times out after 5m)..."
% docker_url,
Expand Down

0 comments on commit 90678ed

Please sign in to comment.