File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
packages/models-library/src/models_library/api_schemas_long_running_tasks
services/web/server/src/simcore_service_webserver/api/v0 Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1+ import urllib .parse
12from datetime import datetime
23from typing import Any
34
4- from pydantic import BaseModel
5+ from pydantic import BaseModel , field_validator
56
67from .base import TaskId , TaskProgress
78
@@ -20,6 +21,22 @@ class TaskResult(BaseModel):
2021class TaskBase (BaseModel ):
2122 task_id : TaskId
2223
24+ # NOTE: task name can always be extraced from the task_id
25+ # since it'e encoded inside it
26+ task_name : str = ""
27+
28+ @field_validator ("task_name" , mode = "before" )
29+ @classmethod
30+ def populate_task_name (cls , _ , info ):
31+ task_name = ""
32+ task_id = info .data .get ("task_id" )
33+ if task_id :
34+ parts = task_id .split ("." )
35+ if len (parts ) >= 1 :
36+ task_name = parts [1 ]
37+
38+ return urllib .parse .unquote (task_name )
39+
2340
2441class TaskGet (TaskBase ):
2542 status_href : str
Original file line number Diff line number Diff line change @@ -16716,6 +16716,9 @@ components:
1671616716 task_id :
1671716717 type : string
1671816718 title : Task Id
16719+ task_name :
16720+ type : string
16721+ title : Task Name
1671916722 status_href :
1672016723 type : string
1672116724 title : Status Href
@@ -16728,6 +16731,7 @@ components:
1672816731 type : object
1672916732 required :
1673016733 - task_id
16734+ - task_name
1673116735 - status_href
1673216736 - result_href
1673316737 - abort_href
You can’t perform that action at this time.
0 commit comments