Skip to content

Commit

Permalink
Catch cases when Docker container cannot start for a reason and fail …
Browse files Browse the repository at this point in the history
…the bundles
  • Loading branch information
bkgoksel committed Aug 14, 2018
1 parent be06951 commit 251ba23
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions worker/codalabworker/local_run/local_run_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,21 @@ def _transition_from_PREPARING(self, run_state):
return run_state._replace(stage=LocalRunStage.CLEANING_UP, info=run_state.info)

# 4) Start container
container_id = self._run_manager.docker.start_container(
run_state.bundle_path,
bundle_uuid,
run_state.bundle['command'],
run_state.resources['docker_image'],
docker_network,
dependencies,
cpuset,
gpuset,
run_state.resources['request_memory'],
)
try:
container_id = self._run_manager.docker.start_container(
run_state.bundle_path,
bundle_uuid,
run_state.bundle['command'],
run_state.resources['docker_image'],
docker_network,
dependencies,
cpuset,
gpuset,
run_state.resources['request_memory'],
)
except DockerException as e:
run_state.info['failure_message'] = 'Cannot start Docker container'.format(e)
return run_state._replace(stage=LocalRunStage.CLEANING_UP, info=run_state.info)

digest = self._run_manager.docker.get_image_repo_digest(run_state.resources['docker_image'])

Expand Down

0 comments on commit 251ba23

Please sign in to comment.