Fix clearml-task exit with error when failing to verify output_uri (output warning instead)

This commit is contained in:
allegroai 2021-08-30 20:57:12 +03:00
parent 08f01967ce
commit 63c3e446a3

View File

@ -168,16 +168,14 @@ class CreateAndPopulate(object):
print('Cloning task {}'.format(self.base_task_id)) print('Cloning task {}'.format(self.base_task_id))
task = Task.clone(source_task=self.base_task_id, project=Task.get_project_id(self.project_name)) task = Task.clone(source_task=self.base_task_id, project=Task.get_project_id(self.project_name))
if self.output_uri: self._set_output_uri(task)
task.output_uri = self.output_uri
else: else:
# noinspection PyProtectedMember # noinspection PyProtectedMember
task = Task._create( task = Task._create(
task_name=self.task_name, project_name=self.project_name, task_name=self.task_name, project_name=self.project_name,
task_type=self.task_type or Task.TaskTypes.training) task_type=self.task_type or Task.TaskTypes.training)
if self.output_uri: self._set_output_uri(task)
task.output_uri = self.output_uri
# if there is nothing to populate, return # if there is nothing to populate, return
if not any([ if not any([
@ -334,6 +332,15 @@ class CreateAndPopulate(object):
self.task = task self.task = task
return task return task
def _set_output_uri(self, task):
if self.output_uri:
try:
task.output_uri = self.output_uri
except ValueError:
getLogger().warning('Could not verify permission for output_uri: "{}"'.format(self.output_uri))
# do not verify the output uri (it might not be valid when we are creating the Task)
task.storage_uri = self.output_uri
def update_task_args(self, args=None): def update_task_args(self, args=None):
# type: (Optional[Union[Sequence[str], Sequence[Tuple[str, str]]]]) -> () # type: (Optional[Union[Sequence[str], Sequence[Tuple[str, str]]]]) -> ()
""" """