Skip to content

Commit

Permalink
Regenerate client
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Oct 26, 2023
1 parent dcae2f7 commit 1721185
Show file tree
Hide file tree
Showing 5 changed files with 564 additions and 11 deletions.
228 changes: 228 additions & 0 deletions src/diracx/client/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
build_auth_userinfo_request,
build_config_serve_config_request,
build_jobs_delete_bulk_jobs_request,
build_jobs_delete_single_job_request,
build_jobs_get_job_status_bulk_request,
build_jobs_get_job_status_history_bulk_request,
build_jobs_get_sandbox_file_request,
Expand All @@ -43,6 +44,9 @@
build_jobs_get_single_job_status_request,
build_jobs_initiate_sandbox_upload_request,
build_jobs_kill_bulk_jobs_request,
build_jobs_kill_single_job_request,
build_jobs_remove_bulk_jobs_request,
build_jobs_remove_single_job_request,
build_jobs_reschedule_bulk_jobs_request,
build_jobs_reschedule_single_job_request,
build_jobs_search_request,
Expand Down Expand Up @@ -1283,6 +1287,64 @@ async def kill_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:

return deserialized

@distributed_trace_async
async def remove_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
"""Remove Bulk Jobs.
Fully remove a list of jobs from the WMS databases.
WARNING: This endpoint has been implemented for the compatibility with the legacy DIRAC WMS
and the JobCleaningAgent. However, once this agent is ported to diracx, this endpoint should
be removed, and the delete endpoint should be used instead for any other purpose.
:keyword job_ids: Required.
:paramtype job_ids: list[int]
: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 = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

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

request = build_jobs_remove_bulk_jobs_request(
job_ids=job_ids,
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)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

@distributed_trace_async
async def get_job_status_bulk(
self, *, job_ids: List[int], **kwargs: Any
Expand Down Expand Up @@ -1948,6 +2010,172 @@ async def get_single_job(self, job_id: int, **kwargs: Any) -> Any:

return deserialized

@distributed_trace_async
async def delete_single_job(self, job_id: int, **kwargs: Any) -> Any:
"""Delete Single Job.
Delete a job by killing and setting the job status to DELETED.
:param job_id: Required.
:type job_id: int
: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 = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

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

request = build_jobs_delete_single_job_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)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

@distributed_trace_async
async def kill_single_job(self, job_id: int, **kwargs: Any) -> Any:
"""Kill Single Job.
Kill a job.
:param job_id: Required.
:type job_id: int
: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 = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

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

request = build_jobs_kill_single_job_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)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

@distributed_trace_async
async def remove_single_job(self, job_id: int, **kwargs: Any) -> Any:
"""Remove Single Job.
Fully remove a job from the WMS databases.
WARNING: This endpoint has been implemented for the compatibility with the legacy DIRAC WMS
and the JobCleaningAgent. However, once this agent is ported to diracx, this endpoint should
be removed, and the delete endpoint should be used instead.
:param job_id: Required.
:type job_id: int
: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 = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

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

request = build_jobs_remove_single_job_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)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

@distributed_trace_async
async def get_single_job_status(
self, job_id: int, **kwargs: Any
Expand Down
4 changes: 4 additions & 0 deletions src/diracx/client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from ._models import SandboxInfo
from ._models import SandboxUploadResponse
from ._models import ScalarSearchSpec
from ._models import ScalarSearchSpecValue
from ._models import SetJobStatusReturn
from ._models import SortSpec
from ._models import SortSpecDirection
Expand All @@ -32,6 +33,7 @@
from ._models import ValidationError
from ._models import ValidationErrorLocItem
from ._models import VectorSearchSpec
from ._models import VectorSearchSpecValues

from ._enums import ChecksumAlgorithm
from ._enums import Enum0
Expand Down Expand Up @@ -68,6 +70,7 @@
"SandboxInfo",
"SandboxUploadResponse",
"ScalarSearchSpec",
"ScalarSearchSpecValue",
"SetJobStatusReturn",
"SortSpec",
"SortSpecDirection",
Expand All @@ -78,6 +81,7 @@
"ValidationError",
"ValidationErrorLocItem",
"VectorSearchSpec",
"VectorSearchSpecValues",
"ChecksumAlgorithm",
"Enum0",
"Enum1",
Expand Down
36 changes: 28 additions & 8 deletions src/diracx/client/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ class ScalarSearchSpec(_serialization.Model):
"like".
:vartype operator: str or ~client.models.ScalarSearchOperator
:ivar value: Value. Required.
:vartype value: str
:vartype value: ~client.models.ScalarSearchSpecValue
"""

_validation = {
Expand All @@ -726,15 +726,15 @@ class ScalarSearchSpec(_serialization.Model):
_attribute_map = {
"parameter": {"key": "parameter", "type": "str"},
"operator": {"key": "operator", "type": "str"},
"value": {"key": "value", "type": "str"},
"value": {"key": "value", "type": "ScalarSearchSpecValue"},
}

def __init__(
self,
*,
parameter: str,
operator: Union[str, "_models.ScalarSearchOperator"],
value: str,
value: "_models.ScalarSearchSpecValue",
**kwargs: Any
) -> None:
"""
Expand All @@ -744,14 +744,24 @@ def __init__(
"like".
:paramtype operator: str or ~client.models.ScalarSearchOperator
:keyword value: Value. Required.
:paramtype value: str
:paramtype value: ~client.models.ScalarSearchSpecValue
"""
super().__init__(**kwargs)
self.parameter = parameter
self.operator = operator
self.value = value


class ScalarSearchSpecValue(_serialization.Model):
"""Value."""

_attribute_map = {}

def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)


class SetJobStatusReturn(_serialization.Model):
"""SetJobStatusReturn.
Expand Down Expand Up @@ -1093,7 +1103,7 @@ class VectorSearchSpec(_serialization.Model):
:ivar operator: An enumeration. Required. Known values are: "in" and "not in".
:vartype operator: str or ~client.models.VectorSearchOperator
:ivar values: Values. Required.
:vartype values: list[str]
:vartype values: ~client.models.VectorSearchSpecValues
"""

_validation = {
Expand All @@ -1105,15 +1115,15 @@ class VectorSearchSpec(_serialization.Model):
_attribute_map = {
"parameter": {"key": "parameter", "type": "str"},
"operator": {"key": "operator", "type": "str"},
"values": {"key": "values", "type": "[str]"},
"values": {"key": "values", "type": "VectorSearchSpecValues"},
}

def __init__(
self,
*,
parameter: str,
operator: Union[str, "_models.VectorSearchOperator"],
values: List[str],
values: "_models.VectorSearchSpecValues",
**kwargs: Any
) -> None:
"""
Expand All @@ -1122,14 +1132,24 @@ def __init__(
:keyword operator: An enumeration. Required. Known values are: "in" and "not in".
:paramtype operator: str or ~client.models.VectorSearchOperator
:keyword values: Values. Required.
:paramtype values: list[str]
:paramtype values: ~client.models.VectorSearchSpecValues
"""
super().__init__(**kwargs)
self.parameter = parameter
self.operator = operator
self.values = values


class VectorSearchSpecValues(_serialization.Model):
"""Values."""

_attribute_map = {}

def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)


class VOInfo(_serialization.Model):
"""VOInfo.
Expand Down
Loading

0 comments on commit 1721185

Please sign in to comment.