Skip to content

Commit 5f53193

Browse files
committed
new round
1 parent 8cf3932 commit 5f53193

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

packages/models-library/src/models_library/api_schemas_directorv2/clusters.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class TaskCounts(BaseModel):
2020

2121

2222
class WorkerMetrics(BaseModel):
23-
cpu: float = Field(..., description="consumed % of cpus")
24-
memory: ByteSize = Field(..., description="consumed memory")
25-
num_fds: int = Field(..., description="consumed file descriptors")
26-
task_counts: TaskCounts = Field(..., description="task details")
23+
cpu: Annotated[float, Field(description="consumed % of cpus")]
24+
memory: Annotated[ByteSize, Field(description="consumed memory")]
25+
num_fds: Annotated[int, Field(description="consumed file descriptors")]
26+
task_counts: Annotated[TaskCounts, Field(description="task details")]
2727

2828

2929
AvailableResources: TypeAlias = DictModel[str, PositiveFloat]
@@ -54,7 +54,7 @@ class Worker(BaseModel):
5454

5555

5656
class Scheduler(BaseModel):
57-
status: str = Field(..., description="The running status of the scheduler")
57+
status: Annotated[str, Field(description="The running status of the scheduler")]
5858
workers: Annotated[WorkersDict | None, Field(default_factory=dict)]
5959

6060
@field_validator("workers", mode="before")
@@ -66,10 +66,5 @@ def ensure_workers_is_empty_dict(cls, v):
6666

6767

6868
class ClusterDetails(BaseModel):
69-
scheduler: Scheduler = Field(
70-
...,
71-
description="This contains dask scheduler information given by the underlying dask library",
72-
)
73-
dashboard_link: AnyUrl = Field(
74-
..., description="Link to this scheduler's dashboard"
75-
)
69+
scheduler: Annotated[Scheduler, Field(description="scheduler information")]
70+
dashboard_link: Annotated[AnyUrl, Field(description="Link to the dask dashboard")]

packages/models-library/src/models_library/api_schemas_directorv2/errors.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
from typing import Annotated
2+
13
from pydantic import BaseModel, Field
24

35

46
class Error(BaseModel):
5-
code: str | None = Field(None, description="Server Exception")
7+
code: Annotated[str | None, Field(description="Server Exception")] = None
68

79

810
class ErrorType(BaseModel):
9-
message: str = Field(..., description="Error message")
11+
message: Annotated[str, Field(description="Error message")]
12+
status: Annotated[int, Field(description="Error code")]
1013
errors: list[Error] | None = None
11-
status: int = Field(..., description="Error code")
1214

1315

1416
class ErrorEnveloped(BaseModel):

packages/models-library/src/models_library/api_schemas_long_running_tasks/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class TaskProgress(BaseModel):
1818
defined as a float bound between 0.0 and 1.0
1919
"""
2020

21-
task_id: TaskId | None = Field(default=None)
22-
message: ProgressMessage = Field(default="")
23-
percent: ProgressPercent = Field(default=0.0)
21+
task_id: TaskId | None = None
22+
message: ProgressMessage = ""
23+
percent: ProgressPercent = 0.0
2424

2525
@validate_call
2626
def update(

0 commit comments

Comments
 (0)