Skip to content

Commit 51ef580

Browse files
committed
make AsyncJobFilter minimal
1 parent 4462b0e commit 51ef580

File tree

1 file changed

+4
-16
lines changed
  • packages/models-library/src/models_library/api_schemas_rpc_async_jobs

1 file changed

+4
-16
lines changed

packages/models-library/src/models_library/api_schemas_rpc_async_jobs/async_jobs.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@
33

44
from pydantic import BaseModel, ConfigDict, StringConstraints
55

6-
from ..products import ProductName
76
from ..progress_bar import ProgressReport
8-
from ..users import UserID
97

108
AsyncJobId: TypeAlias = UUID
119
AsyncJobName: TypeAlias = Annotated[
1210
str, StringConstraints(strip_whitespace=True, min_length=1)
1311
]
1412

1513

16-
class AsyncJobFilterBase(BaseModel):
17-
"""Base class for async job filters"""
18-
19-
model_config = ConfigDict(extra="forbid")
20-
21-
2214
class AsyncJobStatus(BaseModel):
2315
job_id: AsyncJobId
2416
progress: ProgressReport
@@ -50,24 +42,20 @@ class AsyncJobAbort(BaseModel):
5042
job_id: AsyncJobId
5143

5244

53-
class AsyncJobFilter(AsyncJobFilterBase):
45+
class AsyncJobFilter(BaseModel):
5446
"""Data for controlling access to an async job"""
5547

5648
model_config = ConfigDict(
49+
extra="allow",
5750
json_schema_extra={
5851
"examples": [
5952
{
6053
"product_name": "osparc",
6154
"user_id": 123,
62-
"client_name": "web_client",
55+
"task_owner": "web_client",
6356
}
6457
]
6558
},
6659
)
6760

68-
product_name: ProductName
69-
user_id: UserID
70-
task_owner: Annotated[ # this is the name of the app which *submits* the async job. It is mainly used for filtering purposes
71-
str,
72-
StringConstraints(min_length=1, pattern=r"^[^\s]+$"),
73-
]
61+
task_owner: Annotated[str, StringConstraints(min_length=1, pattern=r"^[a-z_-]+$")]

0 commit comments

Comments
 (0)