From e17b3f7f441eec9c67889eccb2112cef5002a43d Mon Sep 17 00:00:00 2001 From: qutech-machine Date: Wed, 22 Jan 2025 16:31:46 +0000 Subject: [PATCH] [QI2-1311] Added job error data fields to jobs --- README.md | 2 +- compute_api_client/api/jobs_api.py | 68 ++++++++++++++++++++++++++ compute_api_client/docs/Job.md | 4 ++ compute_api_client/docs/JobPatch.md | 4 ++ compute_api_client/docs/JobsApi.md | 12 ++++- compute_api_client/models/job.py | 14 ++++-- compute_api_client/models/job_patch.py | 18 +++++-- pyproject.toml | 2 +- 8 files changed, 113 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 40935be..f762872 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Authentication schemes defined for the API: - **Type**: OAuth - **Flow**: accessCode -- **Authorization URL**: https://quantum-inspire-development.eu.auth0.com/protocol/openid-connect/auth +- **Authorization URL**: https://auth.qi2.quantum-inspire.com/realms/oidc_development/protocol/openid-connect/auth - **Scopes**: N/A diff --git a/compute_api_client/api/jobs_api.py b/compute_api_client/api/jobs_api.py index ca476f4..b8922b6 100644 --- a/compute_api_client/api/jobs_api.py +++ b/compute_api_client/api/jobs_api.py @@ -878,6 +878,10 @@ async def read_jobs_jobs_get( number_of_shots__isnull: Optional[StrictBool] = None, number_of_shots: Optional[StrictInt] = None, raw_data_enabled: Optional[StrictBool] = None, + session_id: Optional[StrictStr] = None, + trace_id: Optional[StrictStr] = None, + message: Optional[StrictStr] = None, + source: Optional[StrictStr] = None, sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None, latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None, page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None, @@ -925,6 +929,14 @@ async def read_jobs_jobs_get( :type number_of_shots: int :param raw_data_enabled: :type raw_data_enabled: bool + :param session_id: + :type session_id: str + :param trace_id: + :type trace_id: str + :param message: + :type message: str + :param source: + :type source: str :param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. :type sort_by: str :param latest: If True gets the most recently created object. @@ -969,6 +981,10 @@ async def read_jobs_jobs_get( number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, + session_id=session_id, + trace_id=trace_id, + message=message, + source=source, sort_by=sort_by, latest=latest, page=page, @@ -1011,6 +1027,10 @@ async def read_jobs_jobs_get_with_http_info( number_of_shots__isnull: Optional[StrictBool] = None, number_of_shots: Optional[StrictInt] = None, raw_data_enabled: Optional[StrictBool] = None, + session_id: Optional[StrictStr] = None, + trace_id: Optional[StrictStr] = None, + message: Optional[StrictStr] = None, + source: Optional[StrictStr] = None, sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None, latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None, page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None, @@ -1058,6 +1078,14 @@ async def read_jobs_jobs_get_with_http_info( :type number_of_shots: int :param raw_data_enabled: :type raw_data_enabled: bool + :param session_id: + :type session_id: str + :param trace_id: + :type trace_id: str + :param message: + :type message: str + :param source: + :type source: str :param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. :type sort_by: str :param latest: If True gets the most recently created object. @@ -1102,6 +1130,10 @@ async def read_jobs_jobs_get_with_http_info( number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, + session_id=session_id, + trace_id=trace_id, + message=message, + source=source, sort_by=sort_by, latest=latest, page=page, @@ -1144,6 +1176,10 @@ async def read_jobs_jobs_get_without_preload_content( number_of_shots__isnull: Optional[StrictBool] = None, number_of_shots: Optional[StrictInt] = None, raw_data_enabled: Optional[StrictBool] = None, + session_id: Optional[StrictStr] = None, + trace_id: Optional[StrictStr] = None, + message: Optional[StrictStr] = None, + source: Optional[StrictStr] = None, sort_by: Annotated[Optional[StrictStr], Field(description="The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'.")] = None, latest: Annotated[Optional[StrictBool], Field(description="If True gets the most recently created object.")] = None, page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number")] = None, @@ -1191,6 +1227,14 @@ async def read_jobs_jobs_get_without_preload_content( :type number_of_shots: int :param raw_data_enabled: :type raw_data_enabled: bool + :param session_id: + :type session_id: str + :param trace_id: + :type trace_id: str + :param message: + :type message: str + :param source: + :type source: str :param sort_by: The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. :type sort_by: str :param latest: If True gets the most recently created object. @@ -1235,6 +1279,10 @@ async def read_jobs_jobs_get_without_preload_content( number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, + session_id=session_id, + trace_id=trace_id, + message=message, + source=source, sort_by=sort_by, latest=latest, page=page, @@ -1272,6 +1320,10 @@ def _read_jobs_jobs_get_serialize( number_of_shots__isnull, number_of_shots, raw_data_enabled, + session_id, + trace_id, + message, + source, sort_by, latest, page, @@ -1376,6 +1428,22 @@ def _read_jobs_jobs_get_serialize( _query_params.append(('raw_data_enabled', raw_data_enabled)) + if session_id is not None: + + _query_params.append(('session_id', session_id)) + + if trace_id is not None: + + _query_params.append(('trace_id', trace_id)) + + if message is not None: + + _query_params.append(('message', message)) + + if source is not None: + + _query_params.append(('source', source)) + if sort_by is not None: _query_params.append(('sort_by', sort_by)) diff --git a/compute_api_client/docs/Job.md b/compute_api_client/docs/Job.md index 297bd88..e47721c 100644 --- a/compute_api_client/docs/Job.md +++ b/compute_api_client/docs/Job.md @@ -14,6 +14,10 @@ Name | Type | Description | Notes **finished_at** | **datetime** | | **number_of_shots** | **int** | | **raw_data_enabled** | **bool** | | +**session_id** | **str** | | +**trace_id** | **str** | | +**message** | **str** | | +**source** | **str** | | ## Example diff --git a/compute_api_client/docs/JobPatch.md b/compute_api_client/docs/JobPatch.md index 3836582..10cd61b 100644 --- a/compute_api_client/docs/JobPatch.md +++ b/compute_api_client/docs/JobPatch.md @@ -5,6 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **status** | [**JobStatus**](JobStatus.md) | | +**session_id** | **str** | | [optional] [default to ''] +**trace_id** | **str** | | [optional] [default to ''] +**message** | **str** | | [optional] [default to ''] +**source** | **str** | | [optional] [default to ''] ## Example diff --git a/compute_api_client/docs/JobsApi.md b/compute_api_client/docs/JobsApi.md index 2e190ec..fe7178a 100644 --- a/compute_api_client/docs/JobsApi.md +++ b/compute_api_client/docs/JobsApi.md @@ -244,7 +244,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **read_jobs_jobs_get** -> PageJob read_jobs_jobs_get(id=id, created_on=created_on, file_id=file_id, algorithm_type=algorithm_type, status=status, batch_job_id=batch_job_id, queued_at__isnull=queued_at__isnull, queued_at=queued_at, finished_at__isnull=finished_at__isnull, finished_at=finished_at, number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, sort_by=sort_by, latest=latest, page=page, size=size) +> PageJob read_jobs_jobs_get(id=id, created_on=created_on, file_id=file_id, algorithm_type=algorithm_type, status=status, batch_job_id=batch_job_id, queued_at__isnull=queued_at__isnull, queued_at=queued_at, finished_at__isnull=finished_at__isnull, finished_at=finished_at, number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, session_id=session_id, trace_id=trace_id, message=message, source=source, sort_by=sort_by, latest=latest, page=page, size=size) List jobs @@ -300,6 +300,10 @@ async with compute_api_client.ApiClient(configuration) as api_client: number_of_shots__isnull = True # bool | (optional) number_of_shots = 56 # int | (optional) raw_data_enabled = True # bool | (optional) + session_id = 'session_id_example' # str | (optional) + trace_id = 'trace_id_example' # str | (optional) + message = 'message_example' # str | (optional) + source = 'source_example' # str | (optional) sort_by = 'sort_by_example' # str | The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. (optional) latest = True # bool | If True gets the most recently created object. (optional) page = 1 # int | Page number (optional) (default to 1) @@ -307,7 +311,7 @@ async with compute_api_client.ApiClient(configuration) as api_client: try: # List jobs - api_response = await api_instance.read_jobs_jobs_get(id=id, created_on=created_on, file_id=file_id, algorithm_type=algorithm_type, status=status, batch_job_id=batch_job_id, queued_at__isnull=queued_at__isnull, queued_at=queued_at, finished_at__isnull=finished_at__isnull, finished_at=finished_at, number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, sort_by=sort_by, latest=latest, page=page, size=size) + api_response = await api_instance.read_jobs_jobs_get(id=id, created_on=created_on, file_id=file_id, algorithm_type=algorithm_type, status=status, batch_job_id=batch_job_id, queued_at__isnull=queued_at__isnull, queued_at=queued_at, finished_at__isnull=finished_at__isnull, finished_at=finished_at, number_of_shots__isnull=number_of_shots__isnull, number_of_shots=number_of_shots, raw_data_enabled=raw_data_enabled, session_id=session_id, trace_id=trace_id, message=message, source=source, sort_by=sort_by, latest=latest, page=page, size=size) print("The response of JobsApi->read_jobs_jobs_get:\n") pprint(api_response) except Exception as e: @@ -333,6 +337,10 @@ Name | Type | Description | Notes **number_of_shots__isnull** | **bool**| | [optional] **number_of_shots** | **int**| | [optional] **raw_data_enabled** | **bool**| | [optional] + **session_id** | **str**| | [optional] + **trace_id** | **str**| | [optional] + **message** | **str**| | [optional] + **source** | **str**| | [optional] **sort_by** | **str**| The field name to sort on. Prefix with '-' for descending order. E.g., '-created_on'. | [optional] **latest** | **bool**| If True gets the most recently created object. | [optional] **page** | **int**| Page number | [optional] [default to 1] diff --git a/compute_api_client/models/job.py b/compute_api_client/models/job.py index 9e929f0..a85c162 100644 --- a/compute_api_client/models/job.py +++ b/compute_api_client/models/job.py @@ -19,7 +19,7 @@ from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional -from pydantic import BaseModel, StrictBool, StrictInt +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr from compute_api_client.models.algorithm_type import AlgorithmType from compute_api_client.models.job_status import JobStatus try: @@ -41,7 +41,11 @@ class Job(BaseModel): finished_at: Optional[datetime] number_of_shots: Optional[StrictInt] raw_data_enabled: StrictBool - __properties: ClassVar[List[str]] = ["id", "created_on", "file_id", "algorithm_type", "status", "batch_job_id", "queued_at", "finished_at", "number_of_shots", "raw_data_enabled"] + session_id: StrictStr + trace_id: StrictStr + message: StrictStr + source: StrictStr + __properties: ClassVar[List[str]] = ["id", "created_on", "file_id", "algorithm_type", "status", "batch_job_id", "queued_at", "finished_at", "number_of_shots", "raw_data_enabled", "session_id", "trace_id", "message", "source"] model_config = { "populate_by_name": True, @@ -115,7 +119,11 @@ def from_dict(cls, obj: Dict) -> Self: "queued_at": obj.get("queued_at"), "finished_at": obj.get("finished_at"), "number_of_shots": obj.get("number_of_shots"), - "raw_data_enabled": obj.get("raw_data_enabled") + "raw_data_enabled": obj.get("raw_data_enabled"), + "session_id": obj.get("session_id"), + "trace_id": obj.get("trace_id"), + "message": obj.get("message"), + "source": obj.get("source") }) return _obj diff --git a/compute_api_client/models/job_patch.py b/compute_api_client/models/job_patch.py index 0281e65..5f301f7 100644 --- a/compute_api_client/models/job_patch.py +++ b/compute_api_client/models/job_patch.py @@ -18,8 +18,10 @@ import json -from typing import Any, ClassVar, Dict, List -from pydantic import BaseModel +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field +from typing_extensions import Annotated from compute_api_client.models.job_status import JobStatus try: from typing import Self @@ -31,7 +33,11 @@ class JobPatch(BaseModel): JobPatch """ # noqa: E501 status: JobStatus - __properties: ClassVar[List[str]] = ["status"] + session_id: Optional[Annotated[str, Field(strict=True, max_length=255)]] = '' + trace_id: Optional[Annotated[str, Field(strict=True, max_length=255)]] = '' + message: Optional[StrictStr] = '' + source: Optional[StrictStr] = '' + __properties: ClassVar[List[str]] = ["status", "session_id", "trace_id", "message", "source"] model_config = { "populate_by_name": True, @@ -81,7 +87,11 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "status": obj.get("status") + "status": obj.get("status"), + "session_id": obj.get("session_id") if obj.get("session_id") is not None else '', + "trace_id": obj.get("trace_id") if obj.get("trace_id") is not None else '', + "message": obj.get("message") if obj.get("message") is not None else '', + "source": obj.get("source") if obj.get("source") is not None else '' }) return _obj diff --git a/pyproject.toml b/pyproject.toml index bb6392f..f86a6c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "qi-compute-api-client" -version = "0.44.0" +version = "0.45.0" description = "An API client for the Compute Job Manager of Quantum Inspire." license = "Apache-2.0" authors = ["Quantum Inspire "]