Add Task.set_base_docer() and Task.get_base_docker()

This commit is contained in:
allegroai 2020-02-10 10:25:57 +02:00
parent 73d011fbba
commit c6849985ea

View File

@ -675,12 +675,24 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
def _set_default_docker_image(self):
if not DOCKER_IMAGE_ENV_VAR.exists():
return
self.set_base_docker(DOCKER_IMAGE_ENV_VAR.get(default=""))
def set_base_docker(self, docker_cmd):
"""
Set the base docker image for this experiment
If provided, this value will be used by trains-agent to execute this experiment
inside the provided docker image.
"""
with self._edit_lock:
self.reload()
execution = self.data.execution
execution.docker_cmd = DOCKER_IMAGE_ENV_VAR.get(default="")
execution.docker_cmd = docker_cmd
self._edit(execution=execution)
def get_base_docker(self):
"""Get the base docker command (image) set for this experiment"""
return self._get_task_property('execution.docker_cmd', raise_on_error=False, log_on_error=False)
def set_artifacts(self, artifacts_list=None):
"""
List of artifacts (tasks.Artifact) to update the task