Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/storage/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "simcore_service_storage",
"description": "Service that manages osparc storage backend",
"version": "0.6.0"
"version": "0.7.0"
},
"paths": {
"/v0/": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import StrEnum, auto
from typing import Any, Final, Protocol, Self, TypeAlias
from typing import Any, Final, Protocol, TypeAlias
from uuid import UUID

from models_library.progress_bar import ProgressReport
Expand Down Expand Up @@ -56,26 +56,6 @@ class TaskStatus(BaseModel):
def is_done(self) -> bool:
return self.task_state in _TASK_DONE

# @model_validator(mode="after") This does not work MB
def _check_consistency(self) -> Self:
value = self.progress_report.actual_value
min_value = 0.0
max_value = self.progress_report.total

valid_states = {
TaskState.PENDING: value == min_value,
TaskState.RUNNING: min_value <= value <= max_value,
TaskState.SUCCESS: value == max_value,
TaskState.ABORTED: value == max_value,
TaskState.ERROR: value == max_value,
}

if not valid_states.get(self.task_state, True):
msg = f"Inconsistent progress actual value for state={self.task_state}: {value}"
raise ValueError(msg)

return self


class TaskError(BaseModel):
exc_type: str
Expand Down
Loading