qoro-divi 0.3.1b0__py3-none-any.whl → 0.3.2b0__py3-none-any.whl
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.
Potentially problematic release.
This version of qoro-divi might be problematic. Click here for more details.
- divi/reporter.py +73 -0
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/METADATA +2 -2
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/RECORD +7 -6
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/LICENSE +0 -0
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/LICENSES/.license-header +0 -0
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/LICENSES/Apache-2.0.txt +0 -0
- {qoro_divi-0.3.1b0.dist-info → qoro_divi-0.3.2b0.dist-info}/WHEEL +0 -0
divi/reporter.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from queue import Queue
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProgressReporter(ABC):
|
|
9
|
+
"""An abstract base class for reporting progress of a quantum program."""
|
|
10
|
+
|
|
11
|
+
@abstractmethod
|
|
12
|
+
def update(self, **kwargs):
|
|
13
|
+
"""Provides a progress update."""
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def info(self, message: str, **kwargs):
|
|
18
|
+
"""
|
|
19
|
+
Provides a simple informational message.
|
|
20
|
+
No changes to progress or state.
|
|
21
|
+
"""
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class QueueProgressReporter(ProgressReporter):
|
|
26
|
+
"""Reports progress by putting structured dictionaries onto a Queue."""
|
|
27
|
+
|
|
28
|
+
def __init__(self, job_id: str, progress_queue: Queue):
|
|
29
|
+
self._job_id = job_id
|
|
30
|
+
self._queue = progress_queue
|
|
31
|
+
|
|
32
|
+
def update(self, **kwargs):
|
|
33
|
+
payload = {"job_id": self._job_id, "progress": 1}
|
|
34
|
+
self._queue.put(payload)
|
|
35
|
+
|
|
36
|
+
def info(self, message: str, **kwargs):
|
|
37
|
+
payload = {"job_id": self._job_id, "progress": 0}
|
|
38
|
+
|
|
39
|
+
if "Finished Optimization" in message or "Computed Final Solution" in message:
|
|
40
|
+
payload["final_status"] = "Success"
|
|
41
|
+
elif "poll_attempt" in kwargs:
|
|
42
|
+
payload["poll_attempt"] = kwargs["poll_attempt"]
|
|
43
|
+
payload["max_retries"] = kwargs["max_retries"]
|
|
44
|
+
payload["service_job_id"] = kwargs.get("service_job_id")
|
|
45
|
+
else:
|
|
46
|
+
payload["message"] = message
|
|
47
|
+
|
|
48
|
+
self._queue.put(payload)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class LoggingProgressReporter(ProgressReporter):
|
|
52
|
+
"""Reports progress by logging messages to the console."""
|
|
53
|
+
|
|
54
|
+
def update(self, **kwargs):
|
|
55
|
+
# You can decide how to format the update for logging
|
|
56
|
+
logger.info(f"Finished Iteration #{kwargs['iteration']}\r\n")
|
|
57
|
+
|
|
58
|
+
def info(self, message: str, **kwargs):
|
|
59
|
+
# A special check for iteration updates to mimic old behavior
|
|
60
|
+
if "poll_attempt" in kwargs:
|
|
61
|
+
logger.info(
|
|
62
|
+
rf"Polling Job {kwargs['job_service_id'].split('-')[0]}: {kwargs['poll_attempt']} / {kwargs['max_retries']} retries\r",
|
|
63
|
+
extra={"append": True},
|
|
64
|
+
)
|
|
65
|
+
return
|
|
66
|
+
|
|
67
|
+
if "iteration" in kwargs:
|
|
68
|
+
logger.info(
|
|
69
|
+
f"Running Iteration #{kwargs['iteration'] + 1} circuits: {message}\r"
|
|
70
|
+
)
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
logger.info(message)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: qoro-divi
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2b0
|
|
4
4
|
Summary: A Python library to automate generating, parallelizing, and executing quantum programs.
|
|
5
5
|
Author: Ahmed Darwish
|
|
6
6
|
Author-email: ahmed@qoroquantum.de
|
|
@@ -14,7 +14,7 @@ Requires-Dist: dwave-hybrid (>=0.6.14,<0.7.0)
|
|
|
14
14
|
Requires-Dist: matplotlib (>=3.10.3,<4.0.0)
|
|
15
15
|
Requires-Dist: mitiq (>=0.46,<0.47)
|
|
16
16
|
Requires-Dist: networkx (>=3.5,<4.0)
|
|
17
|
-
Requires-Dist: pennylane (>=0.
|
|
17
|
+
Requires-Dist: pennylane (>=0.42.3,<0.43.0)
|
|
18
18
|
Requires-Dist: ply (>=3.11,<4.0)
|
|
19
19
|
Requires-Dist: pymetis (>=2025.1.1,<2026.0.0)
|
|
20
20
|
Requires-Dist: python-dotenv (>=1.1.1,<2.0.0)
|
|
@@ -52,10 +52,11 @@ divi/qprog/batch.py,sha256=UWiDsABFWNggvR136jBnTg6r5OUuHHh3nOCGL1keAy8,9654
|
|
|
52
52
|
divi/qprog/optimizers.py,sha256=l19zIyt1l0IhUbLofEXlwE9XnsILk7ANlwACi3KKN4w,2034
|
|
53
53
|
divi/qprog/quantum_program.py,sha256=hJ5uraX9ZNicfoJu3X0aAe8KTJUzndgX5GyoHZ1GOB8,16921
|
|
54
54
|
divi/qpu_system.py,sha256=teVeG18ukyzMFgbPSr4BLx4MJUHVK382RqZMOy2voFk,374
|
|
55
|
+
divi/reporter.py,sha256=inR-a1QBhdw96pFBdRGBxhWI-Jmoxy1iWiAH4gLiXrQ,2329
|
|
55
56
|
divi/utils.py,sha256=EEyGakoz33AvU0Rq7iijL8AULMg4FGcGBtmOlpSw-tY,3603
|
|
56
|
-
qoro_divi-0.3.
|
|
57
|
-
qoro_divi-0.3.
|
|
58
|
-
qoro_divi-0.3.
|
|
59
|
-
qoro_divi-0.3.
|
|
60
|
-
qoro_divi-0.3.
|
|
61
|
-
qoro_divi-0.3.
|
|
57
|
+
qoro_divi-0.3.2b0.dist-info/LICENSE,sha256=NS4JlQrgNwg1bvB3kE5shE-P4cJgnntgl-kClbOpG_Q,10760
|
|
58
|
+
qoro_divi-0.3.2b0.dist-info/LICENSES/.license-header,sha256=2jN_xtJscqP8LG-NaveY2KHUkfRCC543Y_XjOyKEfWY,105
|
|
59
|
+
qoro_divi-0.3.2b0.dist-info/LICENSES/Apache-2.0.txt,sha256=yoILHpvVuguUBpk8UwMnzJbcHUUyst9iGNNuEwUtWVc,10270
|
|
60
|
+
qoro_divi-0.3.2b0.dist-info/METADATA,sha256=gEOZ_q1nlexh4yGU8cZx1dY5w7pM24VrDQz_VH1tpOk,2423
|
|
61
|
+
qoro_divi-0.3.2b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
62
|
+
qoro_divi-0.3.2b0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|