Skip to content

Fail if expecting to run in Docker but not available. #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,22 @@ def run(self, dry_run=False, pull_image=True, rm_container=True,

img_id = None
env = None # type: Union[MutableMapping[Text, Text], MutableMapping[str, str]]
if docker_req and kwargs.get("use_container") is not False:
env = os.environ
img_id = docker.get_from_requirements(docker_req, docker_is_req, pull_image)
elif kwargs.get("default_container", None) is not None:
env = os.environ
img_id = kwargs.get("default_container")

if docker_is_req and img_id is None:
raise WorkflowException("Docker is required for running this tool.")
try:
if docker_req and kwargs.get("use_container") is not False:
env = os.environ
img_id = docker.get_from_requirements(docker_req, True, pull_image)
elif kwargs.get("default_container", None) is not None:
env = os.environ
img_id = kwargs.get("default_container")

if docker_req and img_id is None and kwargs.get("use_container"):
raise Exception("Docker image not available")
except Exception as e:
_logger.debug("Docker error", exc_info=True)
if docker_is_req:
raise WorkflowException("Docker is required to run this tool: %s" % e)
else:
raise WorkflowException("Docker is not available for this tool, try --no-container to disable Docker: %s" % e)

if img_id:
runtime = ["docker", "run", "-i"]
Expand Down