Skip to content

Add job monitoring utilities to the routers #593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.4, generator: @autorest/[email protected])
Expand Down Expand Up @@ -40,6 +40,10 @@
build_config_serve_config_request,
build_jobs_add_heartbeat_request,
build_jobs_assign_sandbox_to_job_request,
build_jobs_get_input_data_request,
build_jobs_get_job_heartbeat_info_request,
build_jobs_get_job_jdl_request,
build_jobs_get_job_parameters_request,
build_jobs_get_job_sandbox_request,
build_jobs_get_job_sandboxes_request,
build_jobs_get_sandbox_file_request,
Expand Down Expand Up @@ -2260,6 +2264,232 @@ async def summary(self, body: Union[_models.SummaryParams, IO[bytes]], **kwargs:

return deserialized # type: ignore

@distributed_trace_async
async def get_input_data(self, job_id: int, **kwargs: Any) -> List[Dict[str, Any]]:
"""Get Input Data.

Fetches a job's input data.

:param job_id: Required.
:type job_id: int
:return: list of dict mapping str to any
:rtype: list[dict[str, any]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None)

_request = build_jobs_get_input_data_request(
job_id=job_id,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = self._deserialize("[{object}]", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

return deserialized # type: ignore

@distributed_trace_async
async def get_job_parameters(self, job_id: int, **kwargs: Any) -> List[Dict[str, Any]]:
"""Get Job Parameters.

Get job parameters.

:param job_id: Required.
:type job_id: int
:return: list of dict mapping str to any
:rtype: list[dict[str, any]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[List[Dict[str, Any]]] = kwargs.pop("cls", None)

_request = build_jobs_get_job_parameters_request(
job_id=job_id,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = self._deserialize("[{object}]", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

return deserialized # type: ignore

@distributed_trace_async
async def get_job_jdl(
self, job_id: int, **kwargs: Any
) -> Dict[str, _models.PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties]:
"""Get Job Jdl.

Get job JDLs.

:param job_id: Required.
:type job_id: int
:return: dict mapping str to
PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties
:rtype: dict[str,
~_generated.models.PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[
Dict[str, _models.PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties]
] = kwargs.pop("cls", None)

_request = build_jobs_get_job_jdl_request(
job_id=job_id,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = self._deserialize(
"{PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties}",
pipeline_response.http_response,
)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

return deserialized # type: ignore

@distributed_trace_async
async def get_job_heartbeat_info(self, job_id: int, **kwargs: Any) -> List[
Dict[
str,
_models.PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties,
]
]:
"""Get Job Heartbeat Info.

Get job heartbeat info.

:param job_id: Required.
:type job_id: int
:return: list of dict mapping str to
PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties
:rtype: list[dict[str,
~_generated.models.PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[
List[
Dict[
str,
_models.PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties,
]
]
] = kwargs.pop("cls", None)

_request = build_jobs_get_job_heartbeat_info_request(
job_id=job_id,
headers=_headers,
params=_params,
)
_request.url = self._client.format_url(_request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = self._deserialize(
"[{PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties}]",
pipeline_response.http_response,
)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore

return deserialized # type: ignore

@overload
async def submit_jdl_jobs(
self, body: List[str], *, content_type: str = "application/json", **kwargs: Any
Expand Down
4 changes: 4 additions & 0 deletions diracx-client/src/diracx/client/_generated/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
JobStatusUpdate,
Metadata,
OpenIDConfiguration,
PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties,
PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties,
SandboxDownloadResponse,
SandboxInfo,
SandboxUploadResponse,
Expand Down Expand Up @@ -78,6 +80,8 @@
"JobStatusUpdate",
"Metadata",
"OpenIDConfiguration",
"PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties",
"PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties",
"SandboxDownloadResponse",
"SandboxInfo",
"SandboxUploadResponse",
Expand Down
12 changes: 12 additions & 0 deletions diracx-client/src/diracx/client/_generated/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,18 @@ def __init__(
self.code_challenge_methods_supported = code_challenge_methods_supported


class PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties(
_serialization.Model
): # pylint: disable=name-too-long
"""PathsLs6HcyApiJobsJobIdHeartbeatGetResponses200ContentApplicationJsonSchemaItemsAdditionalproperties."""


class PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties(
_serialization.Model
): # pylint: disable=name-too-long
"""PathsZ91EtjApiJobsJobIdJdlGetResponses200ContentApplicationJsonSchemaAdditionalproperties."""


class SandboxDownloadResponse(_serialization.Model):
"""SandboxDownloadResponse.

Expand Down
Loading
Loading