Fix model update for a deleted task

This commit is contained in:
clearml 2024-12-05 19:08:26 +02:00
parent 39c36527e2
commit 9a69c21504

View File

@ -37,7 +37,7 @@ from apiserver.bll.task.task_cleanup import (
delete_task_events_and_collect_urls, delete_task_events_and_collect_urls,
) )
from apiserver.bll.task.task_operations import publish_task from apiserver.bll.task.task_operations import publish_task
from apiserver.bll.task.utils import get_task_with_write_access from apiserver.bll.task.utils import get_task_with_write_access, deleted_prefix
from apiserver.bll.util import run_batch_operation from apiserver.bll.util import run_batch_operation
from apiserver.config_repo import config from apiserver.config_repo import config
from apiserver.database.model import validate_id from apiserver.database.model import validate_id
@ -222,6 +222,9 @@ last_update_fields = (
def parse_model_fields(call, valid_fields): def parse_model_fields(call, valid_fields):
task_id = call.data.get("task")
if isinstance(task_id, str) and task_id.startswith(deleted_prefix):
call.data.pop("task")
fields = parse_from_call(call.data, valid_fields, Model.get_fields()) fields = parse_from_call(call.data, valid_fields, Model.get_fields())
conform_tag_fields(call, fields, validate=True) conform_tag_fields(call, fields, validate=True)
escape_metadata(fields) escape_metadata(fields)