-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Beta support for configurable dependency resolution & Biocontainers. #214
Changes from all commits
85158a3
ee83315
1e6ea02
ef3e6f2
432ad4c
e7059a2
913f617
6b929f1
79bae7d
b19f60d
461b10f
368f888
02ecac6
a55aee1
0823ce8
3ed134d
15a6ab4
dac661e
0b6f27e
d473e3a
75c8d81
5522e88
fd2ac01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
import pkg_resources # part of setuptools | ||
import requests | ||
import string | ||
|
||
import ruamel.yaml as yaml | ||
import schema_salad.validate as validate | ||
|
@@ -31,9 +32,11 @@ | |
relocateOutputs, scandeps, shortname, use_custom_schema, | ||
use_standard_schema) | ||
from .resolver import ga4gh_tool_registries, tool_resolver | ||
from .software_requirements import DependenciesConfiguration, get_container_from_software_requirements | ||
from .stdfsaccess import StdFsAccess | ||
from .update import ALLUPDATES, UPDATES | ||
|
||
|
||
_logger = logging.getLogger("cwltool") | ||
|
||
defaultStreamHandler = logging.StreamHandler() | ||
|
@@ -149,6 +152,15 @@ def arg_parser(): # type: () -> argparse.ArgumentParser | |
exgroup.add_argument("--quiet", action="store_true", help="Only print warnings and errors.") | ||
exgroup.add_argument("--debug", action="store_true", help="Print even more logging") | ||
|
||
# help="Dependency resolver configuration file describing how to adapt 'SoftwareRequirement' packages to current system." | ||
parser.add_argument("--beta-dependency-resolvers-configuration", default=None, help=argparse.SUPPRESS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this configuration file format documented? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here-ish https://docs.galaxyproject.org/en/latest/admin/dependency_resolvers.html#dependency-resolvers-in-galaxy but the Galaxy docs reference Galaxy requirements and don't mention the file can be YAML like in the examples I've included here or using URIs to disambiguate packages or the local mapping stuff that makes the environment modules work more usable. So I guess the real answer is scattered across a bunch of PRs. Where do you want the cwltool documentation? Should I add it to a new section of the README or create a new file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I thought Galaxy-lib had its own documentation site we could link to.. In the meantime, a new section in the README is fine. |
||
# help="Defaut root directory used by dependency resolvers configuration." | ||
parser.add_argument("--beta-dependencies-directory", default=None, help=argparse.SUPPRESS) | ||
# help="Use biocontainers for tools without an explicitly annotated Docker container." | ||
parser.add_argument("--beta-use-biocontainers", default=None, help=argparse.SUPPRESS, action="store_true") | ||
# help="Short cut to use Conda to resolve 'SoftwareRequirement' packages." | ||
parser.add_argument("--beta-conda-dependencies", default=None, help=argparse.SUPPRESS, action="store_true") | ||
|
||
parser.add_argument("--tool-help", action="store_true", help="Print command line help for tool") | ||
|
||
parser.add_argument("--relative-deps", choices=['primary', 'cwd'], | ||
|
@@ -236,12 +248,6 @@ def output_callback(out, processStatus): | |
for req in jobReqs: | ||
t.requirements.append(req) | ||
|
||
if kwargs.get("default_container"): | ||
t.requirements.insert(0, { | ||
"class": "DockerRequirement", | ||
"dockerPull": kwargs["default_container"] | ||
}) | ||
|
||
jobiter = t.job(job_order_object, | ||
output_callback, | ||
**kwargs) | ||
|
@@ -648,7 +654,8 @@ def main(argsl=None, # type: List[str] | |
'relax_path_checks': False, | ||
'validate': False, | ||
'enable_ga4gh_tool_registry': False, | ||
'ga4gh_tool_registries': [] | ||
'ga4gh_tool_registries': [], | ||
'find_default_container': None | ||
}.iteritems(): | ||
if not hasattr(args, k): | ||
setattr(args, k, v) | ||
|
@@ -716,8 +723,20 @@ def main(argsl=None, # type: List[str] | |
stdout.write(json.dumps(processobj, indent=4)) | ||
return 0 | ||
|
||
conf_file = getattr(args, "beta_dependency_resolvers_configuration", None) # Text | ||
use_conda_dependencies = getattr(args, "beta_conda_dependencies", None) # Text | ||
|
||
make_tool_kwds = vars(args) | ||
|
||
build_job_script = None # type: Callable[[Any, List[str]], Text] | ||
if conf_file or use_conda_dependencies: | ||
dependencies_configuration = DependenciesConfiguration(args) # type: DependenciesConfiguration | ||
make_tool_kwds["build_job_script"] = dependencies_configuration.build_job_script | ||
|
||
make_tool_kwds["find_default_container"] = functools.partial(find_default_container, args) | ||
|
||
tool = make_tool(document_loader, avsc_names, metadata, uri, | ||
makeTool, vars(args)) | ||
makeTool, make_tool_kwds) | ||
|
||
if args.validate: | ||
return 0 | ||
|
@@ -838,5 +857,15 @@ def locToPath(p): | |
_logger.addHandler(defaultStreamHandler) | ||
|
||
|
||
def find_default_container(args, builder): | ||
default_container = None | ||
if args.default_container: | ||
default_container = args.default_container | ||
elif args.beta_use_biocontainers: | ||
default_container = get_container_from_software_requirements(args, builder) | ||
|
||
return default_container | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv[1:])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. should we hide them when the
deps
extra isn't modified? What happens if they are called and galaxy-lib is missing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have clarified this behavior with #459 and improved it a bit.