mirror of
https://github.com/clearml/clearml-server
synced 2025-06-26 23:15:47 +00:00
Fix archived and development system tags should not be cleaned up
This commit is contained in:
parent
6870d8aba9
commit
ba03924cb4
@ -26,6 +26,7 @@ from apiserver.database.model.task.task import (
|
|||||||
ArtifactModes,
|
ArtifactModes,
|
||||||
external_task_types,
|
external_task_types,
|
||||||
)
|
)
|
||||||
|
from apiserver.database.model import EntityVisibility
|
||||||
from apiserver.database.utils import get_company_or_none_constraint, id as create_id
|
from apiserver.database.utils import get_company_or_none_constraint, id as create_id
|
||||||
from apiserver.es_factory import es_factory
|
from apiserver.es_factory import es_factory
|
||||||
from apiserver.service_repo import APICall
|
from apiserver.service_repo import APICall
|
||||||
@ -231,6 +232,16 @@ class TaskBLL:
|
|||||||
|
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
|
|
||||||
|
def clean_system_tags(input_tags: Sequence[str]) -> Sequence[str]:
|
||||||
|
if not input_tags:
|
||||||
|
return input_tags
|
||||||
|
|
||||||
|
return [
|
||||||
|
tag
|
||||||
|
for tag in input_tags
|
||||||
|
if tag not in [TaskSystemTags.development, EntityVisibility.archived.value]
|
||||||
|
]
|
||||||
|
|
||||||
with TimingContext("mongo", "clone task"):
|
with TimingContext("mongo", "clone task"):
|
||||||
new_task = Task(
|
new_task = Task(
|
||||||
id=create_id(),
|
id=create_id(),
|
||||||
@ -244,7 +255,7 @@ class TaskBLL:
|
|||||||
parent=parent or task.parent,
|
parent=parent or task.parent,
|
||||||
project=project or task.project,
|
project=project or task.project,
|
||||||
tags=tags or task.tags,
|
tags=tags or task.tags,
|
||||||
system_tags=system_tags or [],
|
system_tags=system_tags or clean_system_tags(task.system_tags),
|
||||||
type=task.type,
|
type=task.type,
|
||||||
script=task.script,
|
script=task.script,
|
||||||
output=Output(destination=task.output.destination)
|
output=Output(destination=task.output.destination)
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class TestTasksEdit(TestService):
|
|||||||
self.assertEqual(new_task.parent, task)
|
self.assertEqual(new_task.parent, task)
|
||||||
# self.assertEqual(new_task.execution.parameters, execution["parameters"])
|
# self.assertEqual(new_task.execution.parameters, execution["parameters"])
|
||||||
self.assertEqual(new_task.execution.framework, execution_overrides["framework"])
|
self.assertEqual(new_task.execution.framework, execution_overrides["framework"])
|
||||||
self.assertEqual(new_task.system_tags, [])
|
self.assertEqual(new_task.system_tags, ["test"])
|
||||||
|
|
||||||
def test_model_check_in_clone(self):
|
def test_model_check_in_clone(self):
|
||||||
model = self.new_model()
|
model = self.new_model()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user