Skip to content

Commit 4430e06

Browse files
author
Robin VAN DE MERGHEL
committed
feat: Add pilot summary, and refactor jobs one
1 parent ad46d6a commit 4430e06

25 files changed

Lines changed: 656 additions & 178 deletions

File tree

diracx-client/src/diracx/client/_generated/aio/operations/_operations.py

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
build_pilots_delete_pilots_request,
5959
build_pilots_get_pilot_jobs_request,
6060
build_pilots_search_request,
61+
build_pilots_summary_request,
6162
build_pilots_update_pilot_fields_request,
6263
build_well_known_get_installation_metadata_request,
6364
build_well_known_get_jwks_request,
@@ -1982,14 +1983,14 @@ async def search(
19821983

19831984
@overload
19841985
async def summary(
1985-
self, body: _models.JobSummaryParams, *, content_type: str = "application/json", **kwargs: Any
1986+
self, body: _models.SummaryParams, *, content_type: str = "application/json", **kwargs: Any
19861987
) -> Any:
19871988
"""Summary.
19881989
19891990
Show information suitable for plotting.
19901991
19911992
:param body: Required.
1992-
:type body: ~_generated.models.JobSummaryParams
1993+
:type body: ~_generated.models.SummaryParams
19931994
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
19941995
Default value is "application/json".
19951996
:paramtype content_type: str
@@ -2015,13 +2016,13 @@ async def summary(self, body: IO[bytes], *, content_type: str = "application/jso
20152016
"""
20162017

20172018
@distributed_trace_async
2018-
async def summary(self, body: Union[_models.JobSummaryParams, IO[bytes]], **kwargs: Any) -> Any:
2019+
async def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs: Any) -> Any:
20192020
"""Summary.
20202021
20212022
Show information suitable for plotting.
20222023
2023-
:param body: Is either a JobSummaryParams type or a IO[bytes] type. Required.
2024-
:type body: ~_generated.models.JobSummaryParams or IO[bytes]
2024+
:param body: Is either a SummaryParams type or a IO[bytes] type. Required.
2025+
:type body: ~_generated.models.SummaryParams or IO[bytes]
20252026
:return: any
20262027
:rtype: any
20272028
:raises ~azure.core.exceptions.HttpResponseError:
@@ -2046,7 +2047,7 @@ async def summary(self, body: Union[_models.JobSummaryParams, IO[bytes]], **kwar
20462047
if isinstance(body, (IOBase, bytes)):
20472048
_content = body
20482049
else:
2049-
_json = self._serialize.body(body, "JobSummaryParams")
2050+
_json = self._serialize.body(body, "SummaryParams")
20502051

20512052
_request = build_jobs_summary_request(
20522053
content_type=content_type,
@@ -2749,3 +2750,98 @@ async def search(
27492750
return cls(pipeline_response, deserialized, response_headers) # type: ignore
27502751

27512752
return deserialized # type: ignore
2753+
2754+
@overload
2755+
async def summary(
2756+
self, body: _models.SummaryParams, *, content_type: str = "application/json", **kwargs: Any
2757+
) -> Any:
2758+
"""Summary.
2759+
2760+
Show information suitable for plotting.
2761+
2762+
:param body: Required.
2763+
:type body: ~_generated.models.SummaryParams
2764+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
2765+
Default value is "application/json".
2766+
:paramtype content_type: str
2767+
:return: any
2768+
:rtype: any
2769+
:raises ~azure.core.exceptions.HttpResponseError:
2770+
"""
2771+
2772+
@overload
2773+
async def summary(self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> Any:
2774+
"""Summary.
2775+
2776+
Show information suitable for plotting.
2777+
2778+
:param body: Required.
2779+
:type body: IO[bytes]
2780+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2781+
Default value is "application/json".
2782+
:paramtype content_type: str
2783+
:return: any
2784+
:rtype: any
2785+
:raises ~azure.core.exceptions.HttpResponseError:
2786+
"""
2787+
2788+
@distributed_trace_async
2789+
async def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs: Any) -> Any:
2790+
"""Summary.
2791+
2792+
Show information suitable for plotting.
2793+
2794+
:param body: Is either a SummaryParams type or a IO[bytes] type. Required.
2795+
:type body: ~_generated.models.SummaryParams or IO[bytes]
2796+
:return: any
2797+
:rtype: any
2798+
:raises ~azure.core.exceptions.HttpResponseError:
2799+
"""
2800+
error_map: MutableMapping = {
2801+
401: ClientAuthenticationError,
2802+
404: ResourceNotFoundError,
2803+
409: ResourceExistsError,
2804+
304: ResourceNotModifiedError,
2805+
}
2806+
error_map.update(kwargs.pop("error_map", {}) or {})
2807+
2808+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2809+
_params = kwargs.pop("params", {}) or {}
2810+
2811+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
2812+
cls: ClsType[Any] = kwargs.pop("cls", None)
2813+
2814+
content_type = content_type or "application/json"
2815+
_json = None
2816+
_content = None
2817+
if isinstance(body, (IOBase, bytes)):
2818+
_content = body
2819+
else:
2820+
_json = self._serialize.body(body, "SummaryParams")
2821+
2822+
_request = build_pilots_summary_request(
2823+
content_type=content_type,
2824+
json=_json,
2825+
content=_content,
2826+
headers=_headers,
2827+
params=_params,
2828+
)
2829+
_request.url = self._client.format_url(_request.url)
2830+
2831+
_stream = False
2832+
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
2833+
_request, stream=_stream, **kwargs
2834+
)
2835+
2836+
response = pipeline_response.http_response
2837+
2838+
if response.status_code not in [200]:
2839+
map_error(status_code=response.status_code, response=response, error_map=error_map)
2840+
raise HttpResponseError(response=response)
2841+
2842+
deserialized = self._deserialize("object", pipeline_response.http_response)
2843+
2844+
if cls:
2845+
return cls(pipeline_response, deserialized, {}) # type: ignore
2846+
2847+
return deserialized # type: ignore

diracx-client/src/diracx/client/_generated/models/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
InsertedJob,
2525
JobCommand,
2626
JobStatusUpdate,
27-
JobSummaryParams,
28-
JobSummaryParamsSearchItem,
2927
Metadata,
3028
OpenIDConfiguration,
3129
PilotFieldsMapping,
@@ -39,6 +37,8 @@
3937
SetJobStatusReturn,
4038
SetJobStatusReturnSuccess,
4139
SortSpec,
40+
SummaryParams,
41+
SummaryParamsSearchItem,
4242
SupportInfo,
4343
TokenResponse,
4444
UserInfoResponse,
@@ -76,8 +76,6 @@
7676
"InsertedJob",
7777
"JobCommand",
7878
"JobStatusUpdate",
79-
"JobSummaryParams",
80-
"JobSummaryParamsSearchItem",
8179
"Metadata",
8280
"OpenIDConfiguration",
8381
"PilotFieldsMapping",
@@ -91,6 +89,8 @@
9189
"SetJobStatusReturn",
9290
"SetJobStatusReturnSuccess",
9391
"SortSpec",
92+
"SummaryParams",
93+
"SummaryParamsSearchItem",
9494
"SupportInfo",
9595
"TokenResponse",
9696
"UserInfoResponse",

diracx-client/src/diracx/client/_generated/models/_models.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -536,44 +536,6 @@ def __init__(
536536
self.source = source
537537

538538

539-
class JobSummaryParams(_serialization.Model):
540-
"""JobSummaryParams.
541-
542-
All required parameters must be populated in order to send to server.
543-
544-
:ivar grouping: Grouping. Required.
545-
:vartype grouping: list[str]
546-
:ivar search: Search.
547-
:vartype search: list[~_generated.models.JobSummaryParamsSearchItem]
548-
"""
549-
550-
_validation = {
551-
"grouping": {"required": True},
552-
}
553-
554-
_attribute_map = {
555-
"grouping": {"key": "grouping", "type": "[str]"},
556-
"search": {"key": "search", "type": "[JobSummaryParamsSearchItem]"},
557-
}
558-
559-
def __init__(
560-
self, *, grouping: List[str], search: List["_models.JobSummaryParamsSearchItem"] = [], **kwargs: Any
561-
) -> None:
562-
"""
563-
:keyword grouping: Grouping. Required.
564-
:paramtype grouping: list[str]
565-
:keyword search: Search.
566-
:paramtype search: list[~_generated.models.JobSummaryParamsSearchItem]
567-
"""
568-
super().__init__(**kwargs)
569-
self.grouping = grouping
570-
self.search = search
571-
572-
573-
class JobSummaryParamsSearchItem(_serialization.Model):
574-
"""JobSummaryParamsSearchItem."""
575-
576-
577539
class Metadata(_serialization.Model):
578540
"""Metadata.
579541
@@ -1203,6 +1165,44 @@ def __init__(self, *, parameter: str, direction: Union[str, "_models.SortDirecti
12031165
self.direction = direction
12041166

12051167

1168+
class SummaryParams(_serialization.Model):
1169+
"""SummaryParams.
1170+
1171+
All required parameters must be populated in order to send to server.
1172+
1173+
:ivar grouping: Grouping. Required.
1174+
:vartype grouping: list[str]
1175+
:ivar search: Search.
1176+
:vartype search: list[~_generated.models.SummaryParamsSearchItem]
1177+
"""
1178+
1179+
_validation = {
1180+
"grouping": {"required": True},
1181+
}
1182+
1183+
_attribute_map = {
1184+
"grouping": {"key": "grouping", "type": "[str]"},
1185+
"search": {"key": "search", "type": "[SummaryParamsSearchItem]"},
1186+
}
1187+
1188+
def __init__(
1189+
self, *, grouping: List[str], search: List["_models.SummaryParamsSearchItem"] = [], **kwargs: Any
1190+
) -> None:
1191+
"""
1192+
:keyword grouping: Grouping. Required.
1193+
:paramtype grouping: list[str]
1194+
:keyword search: Search.
1195+
:paramtype search: list[~_generated.models.SummaryParamsSearchItem]
1196+
"""
1197+
super().__init__(**kwargs)
1198+
self.grouping = grouping
1199+
self.search = search
1200+
1201+
1202+
class SummaryParamsSearchItem(_serialization.Model):
1203+
"""SummaryParamsSearchItem."""
1204+
1205+
12061206
class SupportInfo(_serialization.Model):
12071207
"""SupportInfo.
12081208

0 commit comments

Comments
 (0)