QuLab 2.4.5__cp312-cp312-win_amd64.whl → 2.4.7__cp312-cp312-win_amd64.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.
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/METADATA +1 -1
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/RECORD +11 -11
- qulab/executor/__main__.py +11 -8
- qulab/executor/schedule.py +30 -17
- qulab/executor/utils.py +1 -1
- qulab/fun.cp312-win_amd64.pyd +0 -0
- qulab/version.py +1 -1
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/LICENSE +0 -0
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/WHEEL +0 -0
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/entry_points.txt +0 -0
- {QuLab-2.4.5.dist-info → QuLab-2.4.7.dist-info}/top_level.txt +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
qulab/__init__.py,sha256=vkFybY8YSsQilYdThPRD83-btPAR41sy_WCXiM-6mME,141
|
|
2
2
|
qulab/__main__.py,sha256=sQ1z8lk9Q4pq7X9lEzLcY8t6Izr6uxQXO0t3qnTUxEs,575
|
|
3
3
|
qulab/dicttree.py,sha256=ZoSJVWK4VMqfzj42gPb_n5RqLlM6K1Me0WmLIfLEYf8,14195
|
|
4
|
-
qulab/fun.cp312-win_amd64.pyd,sha256=
|
|
5
|
-
qulab/version.py,sha256=
|
|
4
|
+
qulab/fun.cp312-win_amd64.pyd,sha256=pKQFlPO8B3vQOzWwqMnSIAKhrdK9tOetfgYHXDCNZx0,32256
|
|
5
|
+
qulab/version.py,sha256=hEWwdPkTm3-PwhJ6bXiKRaQw0V32r2z6903I897HSjE,21
|
|
6
6
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
|
7
|
-
qulab/executor/__main__.py,sha256=
|
|
7
|
+
qulab/executor/__main__.py,sha256=1Mg5fJ0dYSWQnP6wgTa0s6U_WH7NT2lCnCQOHyx_I7c,2430
|
|
8
8
|
qulab/executor/load.py,sha256=jZHkEzFF8ufFAIajkRDKmHYYJxbxI3RcEbAFIbl9VQ0,6208
|
|
9
|
-
qulab/executor/schedule.py,sha256=
|
|
9
|
+
qulab/executor/schedule.py,sha256=zhRbSAsl1zAcTbrPSyH4FzfF6sr2438TcQSUWJcEiIA,9552
|
|
10
10
|
qulab/executor/storage.py,sha256=M66Q5_Uc5MMfc_QAuuaaexwAz7wxBPMkeleB5nRpQmI,4621
|
|
11
11
|
qulab/executor/transform.py,sha256=inaOn6eqCs22ZZ0xAQl8s8YCoEACaXSwFNNu7jqdwAk,2148
|
|
12
|
-
qulab/executor/utils.py,sha256=
|
|
12
|
+
qulab/executor/utils.py,sha256=n3uCSKh-qdDFFeNvOpj7_es2_B4AaC-ASAlV9gPmSO0,3086
|
|
13
13
|
qulab/monitor/__init__.py,sha256=xEVDkJF8issrsDeLqQmDsvtRmrf-UiViFcGTWuzdlFU,43
|
|
14
14
|
qulab/monitor/__main__.py,sha256=k2H1H5Zf9LLXTDLISJkbikLH-z0f1e5i5i6wXXYPOrE,105
|
|
15
15
|
qulab/monitor/config.py,sha256=y_5StMkdrbZO1ziyKBrvIkB7Jclp9RCPK1QbsOhCxnY,785
|
|
@@ -89,9 +89,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
|
|
|
89
89
|
qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
|
|
90
90
|
qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
|
|
91
91
|
qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
|
|
92
|
-
QuLab-2.4.
|
|
93
|
-
QuLab-2.4.
|
|
94
|
-
QuLab-2.4.
|
|
95
|
-
QuLab-2.4.
|
|
96
|
-
QuLab-2.4.
|
|
97
|
-
QuLab-2.4.
|
|
92
|
+
QuLab-2.4.7.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
|
|
93
|
+
QuLab-2.4.7.dist-info/METADATA,sha256=cxrR6y4VIlQi8TsOokvE7qmIOAVyuekjC31dsXtnsOQ,3803
|
|
94
|
+
QuLab-2.4.7.dist-info/WHEEL,sha256=cRmSBGD-cl98KkuHMNqv9Ac9L9_VqTvcBYwpIvxN0cg,101
|
|
95
|
+
QuLab-2.4.7.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
|
96
|
+
QuLab-2.4.7.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
|
97
|
+
QuLab-2.4.7.dist-info/RECORD,,
|
qulab/executor/__main__.py
CHANGED
|
@@ -4,7 +4,8 @@ from pathlib import Path
|
|
|
4
4
|
import click
|
|
5
5
|
|
|
6
6
|
from .load import find_unreferenced_workflows
|
|
7
|
-
from .schedule import maintain as maintain_workflow
|
|
7
|
+
from .schedule import maintain as maintain_workflow
|
|
8
|
+
from .schedule import run as run_workflow
|
|
8
9
|
from .transform import set_config_api
|
|
9
10
|
from .utils import workflow_template
|
|
10
11
|
|
|
@@ -41,9 +42,10 @@ def create(workflow, code):
|
|
|
41
42
|
@click.argument('workflow')
|
|
42
43
|
@click.option('--code', '-c', default=None)
|
|
43
44
|
@click.option('--data', '-d', default=None)
|
|
44
|
-
@click.option('--api', '-
|
|
45
|
+
@click.option('--api', '-a', default=None)
|
|
46
|
+
@click.option('--plot', '-p', is_flag=True)
|
|
45
47
|
@click.option('--no-dependents', '-n', is_flag=True)
|
|
46
|
-
def run(workflow, code, data, api, no_dependents):
|
|
48
|
+
def run(workflow, code, data, api, plot, no_dependents):
|
|
47
49
|
"""
|
|
48
50
|
Run a workflow.
|
|
49
51
|
"""
|
|
@@ -56,17 +58,18 @@ def run(workflow, code, data, api, no_dependents):
|
|
|
56
58
|
data = Path(code) / 'logs'
|
|
57
59
|
|
|
58
60
|
if no_dependents:
|
|
59
|
-
run_workflow(workflow, code, data)
|
|
61
|
+
run_workflow(workflow, code, data, plot=plot)
|
|
60
62
|
else:
|
|
61
|
-
maintain_workflow(workflow, code, data, run=True)
|
|
63
|
+
maintain_workflow(workflow, code, data, run=True, plot=plot)
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
@click.command()
|
|
65
67
|
@click.argument('workflow')
|
|
66
68
|
@click.option('--code', '-c', default=None)
|
|
67
69
|
@click.option('--data', '-d', default=None)
|
|
68
|
-
@click.option('--api', '-
|
|
69
|
-
|
|
70
|
+
@click.option('--api', '-a', default=None)
|
|
71
|
+
@click.option('--plot', '-p', is_flag=True)
|
|
72
|
+
def maintain(workflow, code, data, api, plot):
|
|
70
73
|
"""
|
|
71
74
|
Maintain a workflow.
|
|
72
75
|
"""
|
|
@@ -78,7 +81,7 @@ def maintain(workflow, code, data, api):
|
|
|
78
81
|
if data is None:
|
|
79
82
|
data = Path(code) / 'logs'
|
|
80
83
|
|
|
81
|
-
maintain_workflow(workflow, code, data, run=False)
|
|
84
|
+
maintain_workflow(workflow, code, data, run=False, plot=plot)
|
|
82
85
|
|
|
83
86
|
|
|
84
87
|
cli.add_command(maintain)
|
qulab/executor/schedule.py
CHANGED
|
@@ -59,7 +59,7 @@ def check_state(workflow: str, code_path: str | Path,
|
|
|
59
59
|
return True
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
def call_analyzer(node, data, history, check=False):
|
|
62
|
+
def call_analyzer(node, data, history, check=False, plot=False):
|
|
63
63
|
if check:
|
|
64
64
|
result = transform.params_to_result(
|
|
65
65
|
node.check_analyze(*data,
|
|
@@ -69,13 +69,22 @@ def call_analyzer(node, data, history, check=False):
|
|
|
69
69
|
result = transform.params_to_result(
|
|
70
70
|
node.analyze(*data, history=transform.result_to_params(history)))
|
|
71
71
|
result.fully_calibrated = True
|
|
72
|
+
if plot:
|
|
73
|
+
call_plot(node, result)
|
|
72
74
|
result.data = data
|
|
73
75
|
return result
|
|
74
76
|
|
|
75
77
|
|
|
78
|
+
@logger.catch()
|
|
79
|
+
def call_plot(node, result, check=False):
|
|
80
|
+
if hasattr(node, 'plot') and callable(node.plot):
|
|
81
|
+
state, params, other = transform.result_to_params(result)
|
|
82
|
+
node.plot(state, params, other)
|
|
83
|
+
|
|
84
|
+
|
|
76
85
|
@functools.lru_cache(maxsize=128)
|
|
77
86
|
def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
|
|
78
|
-
session_id: str) -> Result:
|
|
87
|
+
plot: bool, session_id: str) -> Result:
|
|
79
88
|
"""
|
|
80
89
|
check data answers two questions:
|
|
81
90
|
Is the parameter associated with this cal in spec,
|
|
@@ -109,7 +118,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
|
|
|
109
118
|
save_result(workflow, result, state_path)
|
|
110
119
|
|
|
111
120
|
logger.debug(f'Checked "{workflow}" !')
|
|
112
|
-
result = call_analyzer(node, data, history, check=True)
|
|
121
|
+
result = call_analyzer(node, data, history, check=True, plot=plot)
|
|
113
122
|
if result.in_spec:
|
|
114
123
|
logger.debug(f'"{workflow}": checked in spec, renewing result')
|
|
115
124
|
renew_result(workflow, state_path)
|
|
@@ -124,7 +133,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
|
|
|
124
133
|
save_result(workflow, result, state_path)
|
|
125
134
|
|
|
126
135
|
logger.debug(f'Calibrated "{workflow}" !')
|
|
127
|
-
result = call_analyzer(node, data, history, check=False)
|
|
136
|
+
result = call_analyzer(node, data, history, check=False, plot=plot)
|
|
128
137
|
save_result(workflow, result, state_path,
|
|
129
138
|
get_head(workflow, state_path))
|
|
130
139
|
|
|
@@ -133,7 +142,7 @@ def check_data(workflow: str, code_path: str | Path, state_path: str | Path,
|
|
|
133
142
|
|
|
134
143
|
@functools.lru_cache(maxsize=128)
|
|
135
144
|
def calibrate(workflow, code_path: str | Path, state_path: str | Path,
|
|
136
|
-
session_id: str) -> Result:
|
|
145
|
+
plot: bool, session_id: str) -> Result:
|
|
137
146
|
node = load_workflow(workflow, code_path)
|
|
138
147
|
history = find_result(workflow, state_path)
|
|
139
148
|
|
|
@@ -143,19 +152,19 @@ def calibrate(workflow, code_path: str | Path, state_path: str | Path,
|
|
|
143
152
|
result.data = data
|
|
144
153
|
save_result(workflow, result, state_path)
|
|
145
154
|
logger.debug(f'Calibrated "{workflow}" !')
|
|
146
|
-
result = call_analyzer(node, data, history, check=False)
|
|
155
|
+
result = call_analyzer(node, data, history, check=False, plot=plot)
|
|
147
156
|
save_result(workflow, result, state_path, get_head(workflow, state_path))
|
|
148
157
|
return result
|
|
149
158
|
|
|
150
159
|
|
|
151
|
-
def diagnose(node, code_path: str | Path, state_path: str | Path,
|
|
160
|
+
def diagnose(node, code_path: str | Path, state_path: str | Path, plot: bool,
|
|
152
161
|
session_id: str):
|
|
153
162
|
'''
|
|
154
163
|
Returns: True if node or dependent recalibrated.
|
|
155
164
|
'''
|
|
156
165
|
logger.debug(f'diagnose "{node}"')
|
|
157
166
|
# check_data
|
|
158
|
-
result = check_data(node, code_path, state_path, session_id)
|
|
167
|
+
result = check_data(node, code_path, state_path, plot, session_id)
|
|
159
168
|
# in spec case
|
|
160
169
|
if result.in_spec:
|
|
161
170
|
logger.debug(f'"{node}": Checked! In spec, no need to diagnose')
|
|
@@ -164,7 +173,7 @@ def diagnose(node, code_path: str | Path, state_path: str | Path,
|
|
|
164
173
|
recalibrated = []
|
|
165
174
|
if result.bad_data:
|
|
166
175
|
recalibrated = [
|
|
167
|
-
diagnose(n, code_path, state_path, session_id)
|
|
176
|
+
diagnose(n, code_path, state_path, plot, session_id)
|
|
168
177
|
for n in get_dependents(node, code_path)
|
|
169
178
|
]
|
|
170
179
|
if not any(recalibrated) and recalibrated:
|
|
@@ -172,7 +181,7 @@ def diagnose(node, code_path: str | Path, state_path: str | Path,
|
|
|
172
181
|
return False
|
|
173
182
|
# calibrate
|
|
174
183
|
logger.debug(f'recalibrate "{node}" because some dependents recalibrated')
|
|
175
|
-
result = calibrate(node, code_path, state_path, session_id)
|
|
184
|
+
result = calibrate(node, code_path, state_path, plot, session_id)
|
|
176
185
|
if result.bad_data or not result.in_spec:
|
|
177
186
|
raise CalibrationFailedError(
|
|
178
187
|
f'"{node}": All dependents passed, but calibration failed!')
|
|
@@ -189,14 +198,15 @@ def maintain(node,
|
|
|
189
198
|
code_path: str | Path,
|
|
190
199
|
state_path: str | Path,
|
|
191
200
|
session_id: str | None = None,
|
|
192
|
-
run: bool = False
|
|
201
|
+
run: bool = False,
|
|
202
|
+
plot: bool = False):
|
|
193
203
|
if session_id is None:
|
|
194
204
|
session_id = uuid.uuid4().hex
|
|
195
205
|
logger.debug(f'run "{node}"' if run else f'maintain "{node}"')
|
|
196
206
|
# recursive maintain
|
|
197
207
|
for n in get_dependents(node, code_path):
|
|
198
208
|
logger.debug(f'maintain "{n}" because it is depended by "{node}"')
|
|
199
|
-
maintain(n, code_path, state_path, session_id)
|
|
209
|
+
maintain(n, code_path, state_path, session_id, plot=plot)
|
|
200
210
|
else:
|
|
201
211
|
logger.debug(f'"{node}": All dependents maintained')
|
|
202
212
|
# check_state
|
|
@@ -204,7 +214,7 @@ def maintain(node,
|
|
|
204
214
|
logger.debug(f'"{node}": In spec, no need to maintain')
|
|
205
215
|
return
|
|
206
216
|
# check_data
|
|
207
|
-
result = check_data(node, code_path, state_path, session_id)
|
|
217
|
+
result = check_data(node, code_path, state_path, plot, session_id)
|
|
208
218
|
if result.in_spec:
|
|
209
219
|
if not run:
|
|
210
220
|
logger.debug(f'"{node}": In spec, no need to maintain')
|
|
@@ -213,12 +223,12 @@ def maintain(node,
|
|
|
213
223
|
logger.debug(f'"{node}": Bad data, diagnosing dependents')
|
|
214
224
|
for n in get_dependents(node, code_path):
|
|
215
225
|
logger.debug(f'diagnose "{n}" because of "{node}" bad data')
|
|
216
|
-
diagnose(n, code_path, state_path, session_id)
|
|
226
|
+
diagnose(n, code_path, state_path, plot, session_id)
|
|
217
227
|
else:
|
|
218
228
|
logger.debug(f'"{node}": All dependents diagnosed')
|
|
219
229
|
# calibrate
|
|
220
230
|
logger.debug(f'recalibrate "{node}"')
|
|
221
|
-
result = calibrate(node, code_path, state_path, session_id)
|
|
231
|
+
result = calibrate(node, code_path, state_path, plot, session_id)
|
|
222
232
|
if result.bad_data or not result.in_spec:
|
|
223
233
|
raise CalibrationFailedError(
|
|
224
234
|
f'"{node}": All dependents passed, but calibration failed!')
|
|
@@ -226,9 +236,12 @@ def maintain(node,
|
|
|
226
236
|
return
|
|
227
237
|
|
|
228
238
|
|
|
229
|
-
def run(node,
|
|
239
|
+
def run(node,
|
|
240
|
+
code_path: str | Path,
|
|
241
|
+
state_path: str | Path,
|
|
242
|
+
plot: bool = False):
|
|
230
243
|
logger.debug(f'run "{node}" without dependences.')
|
|
231
|
-
result = calibrate(node, code_path, state_path)
|
|
244
|
+
result = calibrate(node, code_path, state_path, plot)
|
|
232
245
|
if result.bad_data or not result.in_spec:
|
|
233
246
|
raise CalibrationFailedError(
|
|
234
247
|
f'"{node}": All dependents passed, but calibration failed!')
|
qulab/executor/utils.py
CHANGED
qulab/fun.cp312-win_amd64.pyd
CHANGED
|
Binary file
|
qulab/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.4.
|
|
1
|
+
__version__ = "2.4.7"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|