Skip to content

Commit 740c9b4

Browse files
committed
feat(scw): add list_jobs
1 parent 04e04ac commit 740c9b4

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

scaleway_qaas_client/v1alpha1/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
from scaleway_qaas_client.v1alpha1.quantum_as_a_service_api_client.api.jobs.list_job_results import (
3030
sync_detailed as _list_job_results_sync,
3131
)
32+
from scaleway_qaas_client.v1alpha1.quantum_as_a_service_api_client.api.jobs.list_jobs import (
33+
sync_detailed as _list_jobs_sync,
34+
)
3235
from scaleway_qaas_client.v1alpha1.quantum_as_a_service_api_client.api.platforms.get_platform import (
3336
sync_detailed as _get_platform_sync,
3437
)
@@ -443,6 +446,27 @@ def get_job(self, job_id: str) -> ScalewayQaasV1Alpha1Job:
443446

444447
return response.parsed
445448

449+
def list_jobs(self, session_id: str) -> List[ScalewayQaasV1Alpha1Job]:
450+
"""List all jobs within a project or session
451+
452+
Retrieve information about all jobs within a given session.
453+
454+
Args:
455+
session_id (str): Unique ID of the session you want to get jobs from.
456+
457+
Raises:
458+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
459+
httpx.TimeoutException: If the request takes longer than Client.timeout.
460+
461+
Returns:
462+
Response[ScalewayQaasV1Alpha1ListJobsResponse]
463+
"""
464+
response = _list_jobs_sync(client=self.__client, session_id=session_id)
465+
466+
_raise_on_error(response)
467+
468+
return response.parsed.jobs
469+
446470
def list_job_results(self, job_id: str) -> List[ScalewayQaasV1Alpha1JobResult]:
447471
"""List all results of a job
448472

scaleway_qaas_client/v1alpha1/quantum_as_a_service_api_client/api/jobs/list_jobs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414

1515
def _get_kwargs(
16+
session_id: str,
1617
*,
1718
tags: Union[Unset, list[str]] = UNSET,
1819
page: Union[Unset, int] = UNSET,
@@ -31,6 +32,8 @@ def _get_kwargs(
3132

3233
params["page_size"] = page_size
3334

35+
params["session_id"] = session_id
36+
3437
json_order_by: Union[Unset, str] = UNSET
3538
if not isinstance(order_by, Unset):
3639
json_order_by = order_by.value
@@ -73,6 +76,7 @@ def _build_response(
7376

7477

7578
def sync_detailed(
79+
session_id: str,
7680
*,
7781
client: AuthenticatedClient,
7882
tags: Union[Unset, list[str]] = UNSET,
@@ -100,6 +104,7 @@ def sync_detailed(
100104
"""
101105

102106
kwargs = _get_kwargs(
107+
session_id=session_id,
103108
tags=tags,
104109
page=page,
105110
page_size=page_size,
@@ -114,6 +119,7 @@ def sync_detailed(
114119

115120

116121
def sync(
122+
session_id: str,
117123
*,
118124
client: AuthenticatedClient,
119125
tags: Union[Unset, list[str]] = UNSET,
@@ -141,6 +147,7 @@ def sync(
141147
"""
142148

143149
return sync_detailed(
150+
session_id=session_id,
144151
client=client,
145152
tags=tags,
146153
page=page,
@@ -150,6 +157,7 @@ def sync(
150157

151158

152159
async def asyncio_detailed(
160+
session_id: str,
153161
*,
154162
client: AuthenticatedClient,
155163
tags: Union[Unset, list[str]] = UNSET,
@@ -177,6 +185,7 @@ async def asyncio_detailed(
177185
"""
178186

179187
kwargs = _get_kwargs(
188+
session_id=session_id,
180189
tags=tags,
181190
page=page,
182191
page_size=page_size,
@@ -189,6 +198,7 @@ async def asyncio_detailed(
189198

190199

191200
async def asyncio(
201+
session_id: str,
192202
*,
193203
client: AuthenticatedClient,
194204
tags: Union[Unset, list[str]] = UNSET,
@@ -217,6 +227,7 @@ async def asyncio(
217227

218228
return (
219229
await asyncio_detailed(
230+
session_id=session_id,
220231
client=client,
221232
tags=tags,
222233
page=page,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
setup(
2424
name="scaleway_qaas_client",
25-
version="0.1.16",
25+
version="0.1.17",
2626
project_urls={
2727
"Documentation": "https://www.scaleway.com/en/quantum-as-a-service/",
2828
"Source": "https://github.com/scaleway/scaleway-qaas-client-pythom",

0 commit comments

Comments
 (0)