Fix task cloning

This commit is contained in:
allegroai 2019-09-15 00:02:23 +03:00
parent c7a687b4a5
commit b98c821cf9
3 changed files with 10 additions and 3 deletions

View File

@ -1705,6 +1705,7 @@ class CreateRequest(Request):
self.assert_isinstance(value, "project", six.string_types)
self._property_project = value
@schema_property('input')
def input(self):
return self._property_input

View File

@ -805,11 +805,17 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
execution = task.execution.to_dict() if task.execution else {}
execution = ConfigTree.merge_configs(ConfigFactory.from_dict(execution),
ConfigFactory.from_dict(execution_overrides or {}))
# clear all artifacts
execution['artifacts'] = [e for e in execution['artifacts'] if e.get('mode') != 'output']
if not tags and task.tags:
tags = [t for t in task.tags if t != cls._development_tag]
req = tasks.CreateRequest(
name=name or task.name,
type=task.type,
input=task.input,
tags=tags if tags is not None else task.tags,
input=task.input if hasattr(task, 'input') else {'view': {}},
tags=tags,
comment=comment or task.comment,
parent=parent,
project=project if project else task.project,

View File

@ -1252,7 +1252,7 @@ class Task(_Task):
tasks.GetAllRequest(
project=[project.id],
name=exact_match_regex(task_name),
only_fields=['id', 'name']
only_fields=['id', 'name', 'last_update']
)
)
task = get_single_result(entity='task', query=task_name, results=res.response.tasks)