diff --git a/clearml_agent/backend_api/config/default/agent.conf b/clearml_agent/backend_api/config/default/agent.conf index e8475dc..5ba4423 100644 --- a/clearml_agent/backend_api/config/default/agent.conf +++ b/clearml_agent/backend_api/config/default/agent.conf @@ -341,4 +341,47 @@ # and arguments specified in the task's container section (setup shell script from the task container section will # be used in any case, if specified). disable_task_docker_override: false + + # Choose the default docker based on the Task properties, + # Examples: 'script.requirements', 'script.binary', 'script.repository', 'script.branch', 'project' + # Notice: Matching is done via regular expression, for example "^searchme$" will match exactly "searchme$" string + # + # "default_docker": { + # "image": "nvidia/cuda:10.2-cudnn7-runtime-ubuntu18.04", + # # optional arguments to pass to docker image + # # arguments: ["--ipc=host", ] + # "match_rules": [ + # { + # "image": "sample_container:tag", + # "arguments": "-e VALUE=1 --ipc=host", + # "match": { + # "script": { + # "requirements": { + # "pip": { + # "tensorflow": "~=1.6" + # } + # }, + # "repository": "", + # "branch": "master" + # }, + # "project": "example" + # } + # }, + # { + # "image": "better_container:tag", + # "arguments": "", + # "match": { + # "container": "replace_me_please" + # } + # }, + # { + # "image": "another_container:tag", + # "arguments": "", + # "match": { + # "project": "^examples", # anything that starts with "examples", e.g. "examples", "examples/sub_project" + # } + # } + # ] + # }, + # } diff --git a/clearml_agent/helper/package/pytorch.py b/clearml_agent/helper/package/pytorch.py index 41ce7d8..3abd1e8 100644 --- a/clearml_agent/helper/package/pytorch.py +++ b/clearml_agent/helper/package/pytorch.py @@ -493,7 +493,15 @@ class PytorchRequirement(SimpleSubstitution): if req.specs and len(req.specs) == 1 and req.specs[0][0] == "==": # remove any +cu extension and let pip resolve that - line = "{} {}".format(req.name, req.format_specs(max_num_parts=3)) + # and add .* if we have 3 parts version to deal with nvidia container 'a' version + # i.e. "1.13.0" -> "1.13.0.*" so it should match preinstalled "1.13.0a0+936e930" + spec_3_parts = req.format_specs(num_parts=3) + spec_max3_parts = req.format_specs(max_num_parts=3) + if spec_3_parts == spec_max3_parts and not spec_max3_parts.endswith("*"): + line = "{} {}.*".format(req.name, spec_max3_parts) + else: + line = "{} {}".format(req.name, spec_max3_parts) + if req.marker: line += " ; {}".format(req.marker) else: