Skip to content

Commit

Permalink
Update client
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Mar 14, 2024
1 parent f04166a commit 363ae5b
Show file tree
Hide file tree
Showing 15 changed files with 505 additions and 32 deletions.
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/_configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/_vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/aio/_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/aio/_configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/aio/_vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion diracx-client/src/diracx/client/aio/operations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down
211 changes: 205 additions & 6 deletions diracx-client/src/diracx/client/aio/operations/_operations.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pylint: disable=too-many-lines,too-many-statements
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from io import IOBase
Expand Down Expand Up @@ -35,8 +35,11 @@
build_auth_revoke_refresh_token_request,
build_auth_userinfo_request,
build_config_serve_config_request,
build_jobs_assign_sandbox_request,
build_jobs_delete_bulk_jobs_request,
build_jobs_delete_single_job_request,
build_jobs_get_job_sandbox_request,
build_jobs_get_job_sandboxes_request,
build_jobs_get_job_status_bulk_request,
build_jobs_get_job_status_history_bulk_request,
build_jobs_get_sandbox_file_request,
Expand Down Expand Up @@ -97,7 +100,7 @@ def __init__(self, *args, **kwargs) -> None:
async def openid_configuration(self, **kwargs: Any) -> Any:
"""Openid Configuration.
Openid Configuration.
OpenID Connect discovery endpoint.
:return: any
:rtype: any
Expand Down Expand Up @@ -150,7 +153,7 @@ async def openid_configuration(self, **kwargs: Any) -> Any:
async def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
"""Installation Metadata.
Installation Metadata.
Get metadata about the dirac installation.
:return: Metadata
:rtype: ~client.models.Metadata
Expand Down Expand Up @@ -427,7 +430,7 @@ async def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> A
async def finished(self, **kwargs: Any) -> Any:
"""Finished.
Finished.
This is the final step of the device flow.
:return: any
:rtype: any
Expand Down Expand Up @@ -655,7 +658,13 @@ async def authorization_flow(
) -> Any:
"""Authorization Flow.
Authorization Flow.
Initiate the authorization flow.
It will redirect to the actual OpenID server (IAM, CheckIn) to
perform a authorization code flow.
We set the user details obtained from the user authorize flow in a cookie
to be able to map the authorization flow with the corresponding
user authorize flow.
:keyword response_type: "code" Required.
:paramtype response_type: str or ~client.models.Enum0
Expand Down Expand Up @@ -731,7 +740,13 @@ async def authorization_flow_complete(
) -> Any:
"""Authorization Flow Complete.
Authorization Flow Complete.
Complete the authorization flow.
The user is redirected back to the DIRAC auth service after completing the IAM's authorization
flow.
We retrieve the original flow details from the decrypted state and store the ID token requested
from the IAM.
The user is then redirected to the client's redirect URI.
:keyword code: Required.
:paramtype code: str
Expand Down Expand Up @@ -1104,6 +1119,190 @@ async def initiate_sandbox_upload(

return deserialized # type: ignore

@distributed_trace_async
async def get_job_sandboxes(
self, job_id: int, **kwargs: Any
) -> Dict[str, List[Any]]:
"""Get Job Sandboxes.
Get input and output sandboxes of given job id at the same time.
:param job_id: Required.
:type job_id: int
:return: dict mapping str to list of any
:rtype: dict[str, list[any]]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
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, List[Any]]] = kwargs.pop("cls", None)

_request = build_jobs_get_job_sandboxes_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]:
if _stream:
await response.read() # Load the body in memory and close the socket
map_error(
status_code=response.status_code, response=response, error_map=error_map
)
raise HttpResponseError(response=response)

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

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

return deserialized # type: ignore

@distributed_trace_async
async def get_job_sandbox(
self, job_id: int, sandbox_type: Union[str, _models.SandboxType], **kwargs: Any
) -> List[Any]:
"""Get Job Sandbox.
Get input or output sandbox from given job.
:param job_id: Required.
:type job_id: int
:param sandbox_type: Known values are: "input" and "output". Required.
:type sandbox_type: str or ~client.models.SandboxType
:return: list of any
:rtype: list[any]
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
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[Any]] = kwargs.pop("cls", None)

_request = build_jobs_get_job_sandbox_request(
job_id=job_id,
sandbox_type=sandbox_type,
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]:
if _stream:
await response.read() # Load the body in memory and close the socket
map_error(
status_code=response.status_code, response=response, error_map=error_map
)
raise HttpResponseError(response=response)

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

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

return deserialized # type: ignore

@distributed_trace_async
async def assign_sandbox(self, job_id: int, body: str, **kwargs: Any) -> Any:
"""Assign Sandbox.
Assign Sandbox.
:param job_id: Required.
:type job_id: int
:param body: Required.
:type body: str
:return: any
:rtype: any
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

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

content_type: str = kwargs.pop(
"content_type", _headers.pop("Content-Type", "application/json")
)
cls: ClsType[Any] = kwargs.pop("cls", None)

_content = self._serialize.body(body, "str")

_request = build_jobs_assign_sandbox_request(
job_id=job_id,
content_type=content_type,
content=_content,
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]:
if _stream:
await response.read() # Load the body in memory and close the socket
map_error(
status_code=response.status_code, response=response, error_map=error_map
)
raise HttpResponseError(response=response)

deserialized = self._deserialize("object", pipeline_response)

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

return deserialized # type: ignore

@overload
async def submit_bulk_jobs(
self, body: List[str], *, content_type: str = "application/json", **kwargs: Any
Expand Down
8 changes: 5 additions & 3 deletions diracx-client/src/diracx/client/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].2)
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/[email protected].7)
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

Expand Down Expand Up @@ -38,13 +38,14 @@
from ._enums import ChecksumAlgorithm
from ._enums import Enum0
from ._enums import Enum1
from ._enums import Enum10
from ._enums import Enum11
from ._enums import Enum12
from ._enums import Enum2
from ._enums import Enum3
from ._enums import Enum4
from ._enums import JobStatus
from ._enums import SandboxFormat
from ._enums import SandboxType
from ._enums import ScalarSearchOperator
from ._enums import VectorSearchOperator
from ._patch import __all__ as _patch_all
Expand Down Expand Up @@ -85,13 +86,14 @@
"ChecksumAlgorithm",
"Enum0",
"Enum1",
"Enum10",
"Enum11",
"Enum12",
"Enum2",
"Enum3",
"Enum4",
"JobStatus",
"SandboxFormat",
"SandboxType",
"ScalarSearchOperator",
"VectorSearchOperator",
]
Expand Down
Loading

0 comments on commit 363ae5b

Please sign in to comment.