Skip to content

Commit 0bccb51

Browse files
authored
Merge pull request #1 from scaleway/client-update
Client update
2 parents 65781ef + 2458ca0 commit 0bccb51

File tree

11 files changed

+82
-352
lines changed

11 files changed

+82
-352
lines changed

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up Python
2222
uses: actions/setup-python@v4
2323
with:
24-
python-version: '3.11'
24+
python-version: '3.12'
2525

2626
- name: Install dependencies
2727
run: |

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Python
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: '3.11'
16+
python-version: '3.12'
1717

1818
- name: Install dependencies
1919
run: |
@@ -39,5 +39,5 @@ jobs:
3939
run: pytest -s --showprogress -vv tests/
4040
env:
4141
CIRQ_SCALEWAY_PROJECT_ID: ${{ secrets.STG_CIRQ_SCALEWAY_PROJECT_ID }}
42-
CIRQ_SCALEWAY_API_TOKEN: ${{ secrets.STG_CIRQ_SCALEWAY_API_TOKEN }}
42+
CIRQ_SCALEWAY_SECRET_KEY: ${{ secrets.STG_CIRQ_SCALEWAY_API_TOKEN }}
4343
CIRQ_SCALEWAY_API_URL: ${{ secrets.STG_CIRQ_SCALEWAY_API_URL }}

cirq_scaleway/scaleway_client.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

cirq_scaleway/scaleway_device.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,20 @@
1515

1616
from typing import Union, Optional
1717

18+
from scaleway_qaas_client import QaaSClient, QaaSPlatform
19+
1820
from .scaleway_session import ScalewaySession
19-
from .scaleway_client import QaaSClient
2021

2122

2223
class ScalewayDevice(cirq.devices.Device):
2324
def __init__(
2425
self,
2526
client: QaaSClient,
26-
id: str,
27-
name: str,
28-
version: str,
29-
num_qubits: int,
30-
metadata: Optional[str],
27+
platform: QaaSPlatform,
3128
) -> None:
3229
self.__id = id
3330
self.__client = client
34-
self.__version = version
35-
self.__num_qubits = num_qubits
36-
self.__name = name
37-
self.__metadata = metadata
31+
self.__platform = platform
3832

3933
def __repr__(self) -> str:
4034
return f"<ScalewayDevice(name={self.__name},num_qubits={self.__num_qubits},platform_id={self.id})>"
@@ -46,7 +40,7 @@ def id(self) -> str:
4640
Returns:
4741
str: The UUID of the platform.
4842
"""
49-
return self.__id
43+
return self.__platform.id
5044

5145
@property
5246
def availability(self) -> str:
@@ -55,9 +49,9 @@ def availability(self) -> str:
5549
Returns:
5650
str: the current availability statys of the session. Can be either: available, shortage or scarce
5751
"""
58-
resp = self.__client.get_platform(self.__id)
52+
platform = self.__client.get_platform(self.__platform.id)
5953

60-
return resp.get("availability")
54+
return platform.availability
6155

6256
@property
6357
def name(self) -> str:
@@ -66,7 +60,7 @@ def name(self) -> str:
6660
Returns:
6761
str: the name of the platform.
6862
"""
69-
return self.__name
63+
return self.__platform.name
7064

7165
@property
7266
def num_qubits(self) -> int:
@@ -76,7 +70,7 @@ def num_qubits(self) -> int:
7670
Returns:
7771
int: the estimated amount of maximum number of runnable qubits.
7872
"""
79-
return self.__num_qubits
73+
return self.__platform.max_qubit_count
8074

8175
@property
8276
def version(self):
@@ -85,13 +79,13 @@ def version(self):
8579
Returns:
8680
str: the platform's version.
8781
"""
88-
return self.__version
82+
return self.__platform.version
8983

9084
def create_session(
9185
self,
9286
name: Optional[str] = "qsim-session-from-cirq",
9387
deduplication_id: Optional[str] = "qsim-session-from-cirq",
94-
max_duration: Union[int, str] = "1h",
88+
max_duration: Union[int, str] = "59m",
9589
max_idle_duration: Union[int, str] = "20m",
9690
) -> ScalewaySession:
9791
"""Create a new device session to run job against.

cirq_scaleway/scaleway_models.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)