Skip to content

Better error no docker #399

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 2 commits into from
May 28, 2017
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion cwltool/draft2tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from .errors import WorkflowException
from .job import JobBase, CommandLineJob, DockerCommandLineJob
from .pathmapper import PathMapper, get_listing, trim_listing
from .process import Process, shortname, uniquename, normalizeFilesDirs, compute_checksums, _logger_validation_warnings
from .process import (Process, shortname, uniquename, normalizeFilesDirs,
compute_checksums, _logger_validation_warnings,
UnsupportedRequirement)
from .stdfsaccess import StdFsAccess
from .utils import aslist

Expand Down Expand Up @@ -177,6 +179,11 @@ def makeJobRunner(self, use_container=True): # type: (Optional[bool]) -> JobBas
if dockerReq and use_container:
return DockerCommandLineJob()
else:
for t in reversed(self.requirements):
if t["class"] == "DockerRequirement":
raise UnsupportedRequirement(
"--no-container, but this CommandLineTool has "
"DockerRequirement under 'requirements'.")
return CommandLineJob()

def makePathMapper(self, reffiles, stagedir, **kwargs):
Expand Down
10 changes: 7 additions & 3 deletions cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from .docker_uid import docker_vm_uid
from .errors import WorkflowException
from .pathmapper import PathMapper
from .process import get_feature, empty_subtree, stageFiles
from .process import (get_feature, empty_subtree, stageFiles,
UnsupportedRequirement)

_logger = logging.getLogger("cwltool")

Expand Down Expand Up @@ -335,9 +336,12 @@ def run(self, pull_image=True, rm_container=True,
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)
raise UnsupportedRequirement(
"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)
raise WorkflowException(
"Docker is not available for this tool, try --no-container"
" to disable Docker: %s" % e)

self._setup()

Expand Down
5 changes: 0 additions & 5 deletions cwltool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,6 @@ def _init_job(self, joborder, **kwargs):
builder.mutation_manager = kwargs.get("mutation_manager")

dockerReq, is_req = self.get_requirement("DockerRequirement")

if dockerReq and is_req and not kwargs.get("use_container"):
raise WorkflowException(
"Document has DockerRequirement under 'requirements' but use_container is false. DockerRequirement must be under 'hints' or use_container must be true.")

builder.make_fs_access = kwargs.get("make_fs_access") or StdFsAccess
builder.fs_access = builder.make_fs_access(kwargs["basedir"])

Expand Down