Skip to content

Commit

Permalink
[QI2-1311] Added job error data fields to jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythir committed Jan 22, 2025
1 parent 219241f commit e17b3f7
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<a id="backend"></a>
Expand Down
68 changes: 68 additions & 0 deletions compute_api_client/api/jobs_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions compute_api_client/docs/Job.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions compute_api_client/docs/JobPatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 10 additions & 2 deletions compute_api_client/docs/JobsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -300,14 +300,18 @@ 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)
size = 50 # int | Page size (optional) (default to 50)

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:
Expand All @@ -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 &#39;-&#39; for descending order. E.g., &#39;-created_on&#39;. | [optional]
**latest** | **bool**| If True gets the most recently created object. | [optional]
**page** | **int**| Page number | [optional] [default to 1]
Expand Down
14 changes: 11 additions & 3 deletions compute_api_client/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand Down
18 changes: 14 additions & 4 deletions compute_api_client/models/job_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down

0 comments on commit e17b3f7

Please sign in to comment.