dwave-cloud-client 0.13.3__tar.gz → 0.13.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/PKG-INFO +16 -16
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/README.rst +14 -15
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/client.py +6 -1
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/models.py +8 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/resources.py +12 -8
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/package_info.py +1 -1
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/solver.py +2 -3
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/logging.py +39 -22
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/PKG-INFO +16 -16
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_utils.py +25 -2
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/LICENSE +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/constants.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/api/exceptions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/_creds.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/config.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/creds.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/flows.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/auth/server.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/cli.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/client/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/client/base.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/client/hybrid.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/client/qpu.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/client/sw.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/coders.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/computation.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/concurrency.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/config/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/config/constants.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/config/exceptions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/config/loaders.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/config/models.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/events.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/exceptions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/regions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/testing/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/testing/mocks.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/upload.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/__init__.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/cli.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/coders.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/decorators.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/dist.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/exception.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/http.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/qubo.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave/cloud/utils/time.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/SOURCES.txt +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/dependency_links.txt +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/entry_points.txt +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/not-zip-safe +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/requires.txt +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/top_level.txt +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/pyproject.toml +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/setup.cfg +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/setup.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_cli.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_client.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_coders.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_concurrency.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_config.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_events.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_exceptions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_mock_solver_loading.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_mock_submission.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_mock_unstructured_submission.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_regions.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_solver.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_solver_utils.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_testing.py +0 -0
- {dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_upload.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dwave-cloud-client
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.4
|
|
4
4
|
Summary: A minimal client for interacting with D-Wave cloud resources.
|
|
5
5
|
Home-page: https://github.com/dwavesystems/dwave-cloud-client
|
|
6
6
|
Author: D-Wave Systems Inc.
|
|
@@ -53,6 +53,7 @@ Dynamic: classifier
|
|
|
53
53
|
Dynamic: description
|
|
54
54
|
Dynamic: home-page
|
|
55
55
|
Dynamic: license
|
|
56
|
+
Dynamic: license-file
|
|
56
57
|
Dynamic: provides-extra
|
|
57
58
|
Dynamic: requires-dist
|
|
58
59
|
Dynamic: requires-python
|
|
@@ -76,6 +77,8 @@ Dynamic: summary
|
|
|
76
77
|
dwave-cloud-client
|
|
77
78
|
==================
|
|
78
79
|
|
|
80
|
+
.. start_cloud_about
|
|
81
|
+
|
|
79
82
|
D-Wave Cloud Client is a minimal implementation of the REST interface used to
|
|
80
83
|
communicate with D-Wave Sampler API (SAPI) servers.
|
|
81
84
|
|
|
@@ -84,9 +87,9 @@ and scheduling for quantum annealing resources at D-Wave Systems.
|
|
|
84
87
|
This package provides a minimal Python interface to that layer without
|
|
85
88
|
compromising the quality of interactions and workflow.
|
|
86
89
|
|
|
87
|
-
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
88
|
-
system's auto-detected default configuration file and samples a random
|
|
89
|
-
tailored to fit the solver's graph.
|
|
90
|
+
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
91
|
+
local system's auto-detected default configuration file and samples a random
|
|
92
|
+
Ising problem tailored to fit the solver's graph.
|
|
90
93
|
|
|
91
94
|
.. code-block:: python
|
|
92
95
|
|
|
@@ -109,13 +112,11 @@ tailored to fit the solver's graph.
|
|
|
109
112
|
# Print the first sample out of a hundred
|
|
110
113
|
print(computation.samples[0])
|
|
111
114
|
|
|
112
|
-
..
|
|
115
|
+
.. end_cloud_about
|
|
113
116
|
|
|
114
117
|
|
|
115
118
|
Installation
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.. installation-start-marker
|
|
119
|
+
============
|
|
119
120
|
|
|
120
121
|
Requires Python 3.8+:
|
|
121
122
|
|
|
@@ -123,7 +124,8 @@ Requires Python 3.8+:
|
|
|
123
124
|
|
|
124
125
|
pip install dwave-cloud-client
|
|
125
126
|
|
|
126
|
-
To install from source (available on GitHub in
|
|
127
|
+
To install from source (available on GitHub in
|
|
128
|
+
`dwavesystems/dwave-cloud-client`_ repo):
|
|
127
129
|
|
|
128
130
|
.. code-block:: bash
|
|
129
131
|
|
|
@@ -132,23 +134,21 @@ To install from source (available on GitHub in `dwavesystems/dwave-cloud-client`
|
|
|
132
134
|
|
|
133
135
|
.. _`dwavesystems/dwave-cloud-client`: https://github.com/dwavesystems/dwave-cloud-client
|
|
134
136
|
|
|
135
|
-
.. installation-end-marker
|
|
136
|
-
|
|
137
137
|
|
|
138
138
|
License
|
|
139
|
-
|
|
139
|
+
=======
|
|
140
140
|
|
|
141
141
|
Released under the Apache License 2.0. See `<LICENSE>`_ file.
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
Contributing
|
|
145
|
-
|
|
145
|
+
============
|
|
146
146
|
|
|
147
|
-
Ocean's `contributing guide <https://docs.
|
|
147
|
+
Ocean's `contributing guide <https://docs.dwavequantum.com/en/latest/ocean/contribute.html>`_
|
|
148
148
|
has guidelines for contributing to Ocean packages.
|
|
149
149
|
|
|
150
150
|
Release Notes
|
|
151
|
-
|
|
151
|
+
-------------
|
|
152
152
|
|
|
153
153
|
D-Wave Cloud Client uses `reno <https://docs.openstack.org/reno/>`_ to manage
|
|
154
154
|
its release notes.
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
dwave-cloud-client
|
|
17
17
|
==================
|
|
18
18
|
|
|
19
|
+
.. start_cloud_about
|
|
20
|
+
|
|
19
21
|
D-Wave Cloud Client is a minimal implementation of the REST interface used to
|
|
20
22
|
communicate with D-Wave Sampler API (SAPI) servers.
|
|
21
23
|
|
|
@@ -24,9 +26,9 @@ and scheduling for quantum annealing resources at D-Wave Systems.
|
|
|
24
26
|
This package provides a minimal Python interface to that layer without
|
|
25
27
|
compromising the quality of interactions and workflow.
|
|
26
28
|
|
|
27
|
-
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
28
|
-
system's auto-detected default configuration file and samples a random
|
|
29
|
-
tailored to fit the solver's graph.
|
|
29
|
+
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
30
|
+
local system's auto-detected default configuration file and samples a random
|
|
31
|
+
Ising problem tailored to fit the solver's graph.
|
|
30
32
|
|
|
31
33
|
.. code-block:: python
|
|
32
34
|
|
|
@@ -49,13 +51,11 @@ tailored to fit the solver's graph.
|
|
|
49
51
|
# Print the first sample out of a hundred
|
|
50
52
|
print(computation.samples[0])
|
|
51
53
|
|
|
52
|
-
..
|
|
54
|
+
.. end_cloud_about
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
Installation
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.. installation-start-marker
|
|
58
|
+
============
|
|
59
59
|
|
|
60
60
|
Requires Python 3.8+:
|
|
61
61
|
|
|
@@ -63,7 +63,8 @@ Requires Python 3.8+:
|
|
|
63
63
|
|
|
64
64
|
pip install dwave-cloud-client
|
|
65
65
|
|
|
66
|
-
To install from source (available on GitHub in
|
|
66
|
+
To install from source (available on GitHub in
|
|
67
|
+
`dwavesystems/dwave-cloud-client`_ repo):
|
|
67
68
|
|
|
68
69
|
.. code-block:: bash
|
|
69
70
|
|
|
@@ -72,23 +73,21 @@ To install from source (available on GitHub in `dwavesystems/dwave-cloud-client`
|
|
|
72
73
|
|
|
73
74
|
.. _`dwavesystems/dwave-cloud-client`: https://github.com/dwavesystems/dwave-cloud-client
|
|
74
75
|
|
|
75
|
-
.. installation-end-marker
|
|
76
|
-
|
|
77
76
|
|
|
78
77
|
License
|
|
79
|
-
|
|
78
|
+
=======
|
|
80
79
|
|
|
81
80
|
Released under the Apache License 2.0. See `<LICENSE>`_ file.
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
Contributing
|
|
85
|
-
|
|
84
|
+
============
|
|
86
85
|
|
|
87
|
-
Ocean's `contributing guide <https://docs.
|
|
86
|
+
Ocean's `contributing guide <https://docs.dwavequantum.com/en/latest/ocean/contribute.html>`_
|
|
88
87
|
has guidelines for contributing to Ocean packages.
|
|
89
88
|
|
|
90
89
|
Release Notes
|
|
91
|
-
|
|
90
|
+
-------------
|
|
92
91
|
|
|
93
92
|
D-Wave Cloud Client uses `reno <https://docs.openstack.org/reno/>`_ to manage
|
|
94
93
|
its release notes.
|
|
@@ -105,4 +104,4 @@ Remove any sections not relevant to your changes.
|
|
|
105
104
|
Commit the file along with your changes.
|
|
106
105
|
|
|
107
106
|
See reno's `user guide <https://docs.openstack.org/reno/latest/user/usage.html>`_
|
|
108
|
-
for details.
|
|
107
|
+
for details.
|
|
@@ -477,8 +477,11 @@ class CachingSession(VersionedAPISession):
|
|
|
477
477
|
if use_cache:
|
|
478
478
|
meta = dict(created=epochnow(), maxage=maxage, etag=etag)
|
|
479
479
|
self._store[key_meta] = meta
|
|
480
|
+
logger.debug("cache_write (meta): %r = %r", key_meta, meta)
|
|
480
481
|
if not only_meta:
|
|
481
|
-
self._store[key_data] = response.content
|
|
482
|
+
content = self._store[key_data] = response.content
|
|
483
|
+
logger.debug("cache_write (data): %r <- (%d bytes)",
|
|
484
|
+
key_data, len(content))
|
|
482
485
|
|
|
483
486
|
logger.debug("response cached for maxage=%r", maxage)
|
|
484
487
|
return True
|
|
@@ -531,6 +534,7 @@ class CachingSession(VersionedAPISession):
|
|
|
531
534
|
return res
|
|
532
535
|
|
|
533
536
|
if not refresh and (meta := self._store.get(key_meta)):
|
|
537
|
+
logger.debug("cache_read (meta): %r = %r", key_meta, meta)
|
|
534
538
|
# respect max-age from response cache-control
|
|
535
539
|
maxage = meta.get('maxage')
|
|
536
540
|
if maxage is None:
|
|
@@ -540,6 +544,7 @@ class CachingSession(VersionedAPISession):
|
|
|
540
544
|
# note: by deferring this lookup, we could save a few ms in case
|
|
541
545
|
# when upstream content was modified (but that doesn't happen often)
|
|
542
546
|
content = self._store.get(key_data)
|
|
547
|
+
logger.debug("cache_read (data): %r -> (%d bytes)", key_data, len(content))
|
|
543
548
|
|
|
544
549
|
if epochnow() - meta['created'] < maxage:
|
|
545
550
|
logger.debug('cache hit within maxage')
|
|
@@ -164,6 +164,14 @@ class ProblemJob(BaseModel):
|
|
|
164
164
|
type: constants.ProblemType
|
|
165
165
|
label: Optional[str] = None
|
|
166
166
|
|
|
167
|
+
@classmethod
|
|
168
|
+
def from_info(cls, info: ProblemInfo):
|
|
169
|
+
return cls(data=info.data,
|
|
170
|
+
params=info.params,
|
|
171
|
+
solver=info.metadata.solver,
|
|
172
|
+
type=info.metadata.type,
|
|
173
|
+
label=info.metadata.label)
|
|
174
|
+
|
|
167
175
|
|
|
168
176
|
class BatchItemError(BaseModel):
|
|
169
177
|
error_code: int
|
|
@@ -293,22 +293,26 @@ class Problems(ResourceBase):
|
|
|
293
293
|
return orjson.loads(response.content)
|
|
294
294
|
|
|
295
295
|
@accepts(media_type='application/vnd.dwave.sapi.problems+json', version='>=2.1,<3')
|
|
296
|
-
@compress_if(lambda obj, **
|
|
297
|
-
def submit_problem(self,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
@compress_if(lambda obj, *_, **__: obj.client.config.get('compress_qpu_problem_data'))
|
|
297
|
+
def submit_problem(self,
|
|
298
|
+
problem: Optional[models.ProblemJob] = None,
|
|
299
|
+
*,
|
|
300
|
+
data: Optional[models.ProblemData] = None,
|
|
301
|
+
params: Optional[dict] = None,
|
|
302
|
+
solver: Optional[str] = None,
|
|
303
|
+
type: Optional[constants.ProblemType] = None,
|
|
302
304
|
label: Optional[str] = None) -> \
|
|
303
305
|
Union[models.ProblemStatusMaybeWithAnswer, models.ProblemSubmitError]:
|
|
304
306
|
"""Blocking problem submit with timeout, returning final status and
|
|
305
307
|
answer, if problem is solved within the (undisclosed) time limit.
|
|
306
308
|
"""
|
|
307
309
|
path = ''
|
|
310
|
+
job_dict = problem.model_dump() if problem is not None else {}
|
|
311
|
+
updates = dict(data=data.model_dump() if data is not None else None,
|
|
312
|
+
params=params, solver=solver, type=type, label=label)
|
|
313
|
+
job_dict.update((k, v) for k, v in updates.items() if v is not None)
|
|
308
314
|
# note: orjson.dumps(model.model_dump()) is about 6-7x faster then
|
|
309
315
|
# model.model_dump_json() - 45us vs 300us (including model construction)
|
|
310
|
-
job_dict = dict(data=data.model_dump(), params=params, solver=solver,
|
|
311
|
-
type=type, label=label)
|
|
312
316
|
data = orjson.dumps(job_dict, option=orjson.OPT_SERIALIZE_NUMPY)
|
|
313
317
|
headers = {'Content-Type': 'application/json'}
|
|
314
318
|
response = self.session.post(path, data=data, headers=headers)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
__packagename__ = 'dwave-cloud-client'
|
|
16
16
|
__title__ = 'D-Wave Cloud Client'
|
|
17
|
-
__version__ = '0.13.
|
|
17
|
+
__version__ = '0.13.4'
|
|
18
18
|
__author__ = 'D-Wave Systems Inc.'
|
|
19
19
|
__description__ = 'A minimal client for interacting with D-Wave cloud resources.'
|
|
20
20
|
__url__ = 'https://github.com/dwavesystems/dwave-cloud-client'
|
|
@@ -1373,10 +1373,9 @@ class StructuredSolver(BaseSolver):
|
|
|
1373
1373
|
|
|
1374
1374
|
Estimates a problem’s quantum processing unit (QPU) access time from the
|
|
1375
1375
|
parameter values you specify, timing data provided in the ``problem_timing_data``
|
|
1376
|
-
|
|
1376
|
+
:ref:`solver property <qpu_solver_properties_all>`,
|
|
1377
1377
|
and the number of qubits used to embed the problem on the selected QPU, as
|
|
1378
|
-
described in the
|
|
1379
|
-
`system documentation <https://docs.dwavesys.com/docs/latest/c_qpu_timing.html>`_.
|
|
1378
|
+
described in the :ref:`qpu_runtime_estimating` section.
|
|
1380
1379
|
|
|
1381
1380
|
Requires that you provide the number of qubits to be used for your
|
|
1382
1381
|
problem submission. :term:`Embedding` is typically heuristic and the number
|
|
@@ -66,8 +66,8 @@ class FilteredSecretsFormatter(logging.Formatter):
|
|
|
66
66
|
return output
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
class JSONFormatter(
|
|
70
|
-
"""Encode record dict as JSON (
|
|
69
|
+
class JSONFormatter(logging.Formatter):
|
|
70
|
+
"""Encode record dict as JSON (str)."""
|
|
71
71
|
|
|
72
72
|
def format(self, record: logging.LogRecord) -> str:
|
|
73
73
|
super().format(record)
|
|
@@ -75,7 +75,7 @@ class JSONFormatter(ISOFormatter):
|
|
|
75
75
|
rec = record.__dict__.copy()
|
|
76
76
|
del rec['args']
|
|
77
77
|
del rec['msg']
|
|
78
|
-
return orjson.dumps(rec)
|
|
78
|
+
return orjson.dumps(rec).decode('utf-8')
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
class BinaryFormatter(logging.Formatter):
|
|
@@ -156,6 +156,7 @@ def configure_logging(logger: Optional[logging.Logger] = None,
|
|
|
156
156
|
level: Union[str, int] = logging.WARNING,
|
|
157
157
|
filter_secrets: bool = True,
|
|
158
158
|
output_stream: Optional[io.BytesIO] = None,
|
|
159
|
+
output_file: Optional[Union[str, bytes, os.PathLike]] = None,
|
|
159
160
|
in_utc: bool = False,
|
|
160
161
|
structured_output: bool = False,
|
|
161
162
|
handler_level: Optional[int] = None,
|
|
@@ -172,45 +173,61 @@ def configure_logging(logger: Optional[logging.Logger] = None,
|
|
|
172
173
|
.. versionadded:: 0.12.0
|
|
173
174
|
Explicit optional logging configuration. Previously, logger was minimally
|
|
174
175
|
configured by default.
|
|
176
|
+
|
|
177
|
+
.. versionadded:: 0.13.4
|
|
178
|
+
``output_file`` parameter to simplify logging to a file.
|
|
175
179
|
"""
|
|
176
180
|
|
|
177
181
|
level = parse_loglevel(level)
|
|
178
182
|
|
|
179
183
|
if logger is None:
|
|
180
184
|
logger = logging.getLogger('dwave.cloud')
|
|
181
|
-
if output_stream is None:
|
|
182
|
-
output_stream = sys.stderr.buffer
|
|
183
185
|
if handler_level is None:
|
|
184
186
|
handler_level = level
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
)
|
|
188
|
+
handler_level = parse_loglevel(handler_level)
|
|
189
|
+
|
|
190
|
+
Formatter = ISOFormatter
|
|
190
191
|
|
|
191
192
|
if structured_output:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
output_formatter = BinaryFormatter
|
|
193
|
+
class Formatter(Formatter, JSONFormatter):
|
|
194
|
+
pass
|
|
195
195
|
|
|
196
196
|
if filter_secrets:
|
|
197
|
-
class Formatter(
|
|
198
|
-
pass
|
|
199
|
-
else:
|
|
200
|
-
class Formatter(output_formatter, ISOFormatter):
|
|
197
|
+
class Formatter(Formatter, FilteredSecretsFormatter):
|
|
201
198
|
pass
|
|
202
199
|
|
|
200
|
+
format = dict(
|
|
201
|
+
fmt='%(asctime)s %(name)s %(levelname)s %(threadName)s [%(funcName)s] %(message)s',
|
|
202
|
+
as_tz=datetime.timezone.utc if in_utc else None,
|
|
203
|
+
)
|
|
204
|
+
formatter = Formatter(**format)
|
|
205
|
+
|
|
203
206
|
if not additive:
|
|
204
207
|
# make sure handlers are not accumulated
|
|
205
208
|
while len(logger.handlers):
|
|
206
|
-
logger.
|
|
209
|
+
handler = logger.handlers[-1]
|
|
210
|
+
# release handler resources before disposing it
|
|
211
|
+
handler.close()
|
|
212
|
+
logger.removeHandler(handler)
|
|
207
213
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
214
|
+
if output_file is None:
|
|
215
|
+
file_handler = None
|
|
216
|
+
else:
|
|
217
|
+
file_handler = logging.FileHandler(output_file)
|
|
218
|
+
file_handler.setFormatter(formatter)
|
|
219
|
+
file_handler.setLevel(handler_level)
|
|
220
|
+
logger.addHandler(file_handler)
|
|
221
|
+
|
|
222
|
+
if output_stream is None and file_handler is None:
|
|
223
|
+
output_stream = sys.stderr
|
|
224
|
+
|
|
225
|
+
if output_stream:
|
|
226
|
+
stream_handler = logging.StreamHandler(stream=output_stream)
|
|
227
|
+
stream_handler.setFormatter(formatter)
|
|
228
|
+
stream_handler.setLevel(handler_level)
|
|
229
|
+
logger.addHandler(stream_handler)
|
|
212
230
|
|
|
213
|
-
logger.addHandler(handler)
|
|
214
231
|
logger.setLevel(level)
|
|
215
232
|
|
|
216
233
|
return logger
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dwave-cloud-client
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.4
|
|
4
4
|
Summary: A minimal client for interacting with D-Wave cloud resources.
|
|
5
5
|
Home-page: https://github.com/dwavesystems/dwave-cloud-client
|
|
6
6
|
Author: D-Wave Systems Inc.
|
|
@@ -53,6 +53,7 @@ Dynamic: classifier
|
|
|
53
53
|
Dynamic: description
|
|
54
54
|
Dynamic: home-page
|
|
55
55
|
Dynamic: license
|
|
56
|
+
Dynamic: license-file
|
|
56
57
|
Dynamic: provides-extra
|
|
57
58
|
Dynamic: requires-dist
|
|
58
59
|
Dynamic: requires-python
|
|
@@ -76,6 +77,8 @@ Dynamic: summary
|
|
|
76
77
|
dwave-cloud-client
|
|
77
78
|
==================
|
|
78
79
|
|
|
80
|
+
.. start_cloud_about
|
|
81
|
+
|
|
79
82
|
D-Wave Cloud Client is a minimal implementation of the REST interface used to
|
|
80
83
|
communicate with D-Wave Sampler API (SAPI) servers.
|
|
81
84
|
|
|
@@ -84,9 +87,9 @@ and scheduling for quantum annealing resources at D-Wave Systems.
|
|
|
84
87
|
This package provides a minimal Python interface to that layer without
|
|
85
88
|
compromising the quality of interactions and workflow.
|
|
86
89
|
|
|
87
|
-
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
88
|
-
system's auto-detected default configuration file and samples a random
|
|
89
|
-
tailored to fit the solver's graph.
|
|
90
|
+
The example below instantiates a D-Wave Cloud Client and solver based on the
|
|
91
|
+
local system's auto-detected default configuration file and samples a random
|
|
92
|
+
Ising problem tailored to fit the solver's graph.
|
|
90
93
|
|
|
91
94
|
.. code-block:: python
|
|
92
95
|
|
|
@@ -109,13 +112,11 @@ tailored to fit the solver's graph.
|
|
|
109
112
|
# Print the first sample out of a hundred
|
|
110
113
|
print(computation.samples[0])
|
|
111
114
|
|
|
112
|
-
..
|
|
115
|
+
.. end_cloud_about
|
|
113
116
|
|
|
114
117
|
|
|
115
118
|
Installation
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.. installation-start-marker
|
|
119
|
+
============
|
|
119
120
|
|
|
120
121
|
Requires Python 3.8+:
|
|
121
122
|
|
|
@@ -123,7 +124,8 @@ Requires Python 3.8+:
|
|
|
123
124
|
|
|
124
125
|
pip install dwave-cloud-client
|
|
125
126
|
|
|
126
|
-
To install from source (available on GitHub in
|
|
127
|
+
To install from source (available on GitHub in
|
|
128
|
+
`dwavesystems/dwave-cloud-client`_ repo):
|
|
127
129
|
|
|
128
130
|
.. code-block:: bash
|
|
129
131
|
|
|
@@ -132,23 +134,21 @@ To install from source (available on GitHub in `dwavesystems/dwave-cloud-client`
|
|
|
132
134
|
|
|
133
135
|
.. _`dwavesystems/dwave-cloud-client`: https://github.com/dwavesystems/dwave-cloud-client
|
|
134
136
|
|
|
135
|
-
.. installation-end-marker
|
|
136
|
-
|
|
137
137
|
|
|
138
138
|
License
|
|
139
|
-
|
|
139
|
+
=======
|
|
140
140
|
|
|
141
141
|
Released under the Apache License 2.0. See `<LICENSE>`_ file.
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
Contributing
|
|
145
|
-
|
|
145
|
+
============
|
|
146
146
|
|
|
147
|
-
Ocean's `contributing guide <https://docs.
|
|
147
|
+
Ocean's `contributing guide <https://docs.dwavequantum.com/en/latest/ocean/contribute.html>`_
|
|
148
148
|
has guidelines for contributing to Ocean packages.
|
|
149
149
|
|
|
150
150
|
Release Notes
|
|
151
|
-
|
|
151
|
+
-------------
|
|
152
152
|
|
|
153
153
|
D-Wave Cloud Client uses `reno <https://docs.openstack.org/reno/>`_ to manage
|
|
154
154
|
its release notes.
|
|
@@ -1073,6 +1073,9 @@ def capture_stderr(fn):
|
|
|
1073
1073
|
|
|
1074
1074
|
class TestLogging(unittest.TestCase):
|
|
1075
1075
|
|
|
1076
|
+
def tearDown(self):
|
|
1077
|
+
configure_logging(logger)
|
|
1078
|
+
|
|
1076
1079
|
@capture_stderr
|
|
1077
1080
|
def test_default_configure(self, output):
|
|
1078
1081
|
configure_logging(logger)
|
|
@@ -1102,7 +1105,7 @@ class TestLogging(unittest.TestCase):
|
|
|
1102
1105
|
|
|
1103
1106
|
@capture_stderr
|
|
1104
1107
|
def test_multiple_handlers(self, output):
|
|
1105
|
-
structured_stream = io.
|
|
1108
|
+
structured_stream = io.StringIO()
|
|
1106
1109
|
|
|
1107
1110
|
configure_logging(
|
|
1108
1111
|
logger, handler_level=logging.ERROR)
|
|
@@ -1119,11 +1122,31 @@ class TestLogging(unittest.TestCase):
|
|
|
1119
1122
|
self.assertEqual(len(error), 1)
|
|
1120
1123
|
self.assertIn('error', error[0])
|
|
1121
1124
|
|
|
1122
|
-
debug = list(map(json.loads, structured_stream.getvalue().
|
|
1125
|
+
debug = list(map(json.loads, structured_stream.getvalue().splitlines()))
|
|
1123
1126
|
self.assertEqual(len(debug), 2)
|
|
1124
1127
|
self.assertEqual(debug[0].get('message'), 'debug')
|
|
1125
1128
|
self.assertEqual(debug[1].get('message'), 'error')
|
|
1126
1129
|
|
|
1130
|
+
@capture_stderr
|
|
1131
|
+
def test_file_logging(self, output):
|
|
1132
|
+
with tempfile.TemporaryDirectory() as dir:
|
|
1133
|
+
logfile = os.path.join(dir, "out.log")
|
|
1134
|
+
|
|
1135
|
+
configure_logging(logger, output_file=logfile)
|
|
1136
|
+
|
|
1137
|
+
logger.error('test-msg')
|
|
1138
|
+
|
|
1139
|
+
# log msg is in the log file
|
|
1140
|
+
with open(logfile, "r") as fp:
|
|
1141
|
+
self.assertIn('test-msg', fp.read())
|
|
1142
|
+
|
|
1143
|
+
# there're no logs on stderr
|
|
1144
|
+
output.seek(0)
|
|
1145
|
+
self.assertEqual(output.read(), '')
|
|
1146
|
+
|
|
1147
|
+
# reset log config to enable temp dir cleanup
|
|
1148
|
+
configure_logging(logger)
|
|
1149
|
+
|
|
1127
1150
|
|
|
1128
1151
|
class TestLoggingHelpers(unittest.TestCase):
|
|
1129
1152
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/requires.txt
RENAMED
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/dwave_cloud_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dwave_cloud_client-0.13.3 → dwave_cloud_client-0.13.4}/tests/test_mock_unstructured_submission.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|