QuLab 2.7.7__cp311-cp311-win_amd64.whl → 2.7.9__cp311-cp311-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.7.7.dist-info → QuLab-2.7.9.dist-info}/METADATA +1 -1
- {QuLab-2.7.7.dist-info → QuLab-2.7.9.dist-info}/RECORD +10 -10
- qulab/executor/schedule.py +83 -80
- qulab/executor/storage.py +20 -12
- qulab/fun.cp311-win_amd64.pyd +0 -0
- qulab/version.py +1 -1
- {QuLab-2.7.7.dist-info → QuLab-2.7.9.dist-info}/LICENSE +0 -0
- {QuLab-2.7.7.dist-info → QuLab-2.7.9.dist-info}/WHEEL +0 -0
- {QuLab-2.7.7.dist-info → QuLab-2.7.9.dist-info}/entry_points.txt +0 -0
- {QuLab-2.7.7.dist-info → QuLab-2.7.9.dist-info}/top_level.txt +0 -0
@@ -1,18 +1,18 @@
|
|
1
1
|
qulab/__init__.py,sha256=RZme5maBSMZpP6ckXymqZpo2sRYttwEpTYCIzIvys1c,292
|
2
2
|
qulab/__main__.py,sha256=FL4YsGZL1jEtmcPc5WbleArzhOHLMsWl7OH3O-1d1ss,72
|
3
3
|
qulab/dicttree.py,sha256=ZoSJVWK4VMqfzj42gPb_n5RqLlM6K1Me0WmLIfLEYf8,14195
|
4
|
-
qulab/fun.cp311-win_amd64.pyd,sha256=
|
4
|
+
qulab/fun.cp311-win_amd64.pyd,sha256=8ns5kxnTz3ufdO6uEj-SZBkxydb_PIewI7Ww4cGZUN0,31744
|
5
5
|
qulab/typing.py,sha256=PRtwbCHWY2ROKK8GHq4Bo8llXrIGo6xC73DrQf7S9os,71
|
6
6
|
qulab/utils.py,sha256=UyZNPIyvis5t2MJBkXXLO5EmYP3mQZbt87zmYAHgoyk,1291
|
7
|
-
qulab/version.py,sha256=
|
7
|
+
qulab/version.py,sha256=2Uj8_mq4WyOkRTNLvNp4euDlxbbREHlgUVtU-CUptMY,21
|
8
8
|
qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
qulab/cli/commands.py,sha256=6xd2eYw32k1NmfAuYSu__1kaP12Oz1QVqwbkYXdWno4,588
|
10
10
|
qulab/cli/config.py,sha256=tNmH4ggdgrFqcQa2WZKLpidiYTg95_UnT0paDJ4fi4c,3204
|
11
11
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
12
12
|
qulab/executor/cli.py,sha256=gGka2M6xccfM8facsIJ2qZ1y2Yx8C4BRhc1JG6nK9mo,8932
|
13
13
|
qulab/executor/load.py,sha256=4FY_SwumLDUewC265v4j_ZGGpfYOgH4c8PtglYcWpBw,18077
|
14
|
-
qulab/executor/schedule.py,sha256=
|
15
|
-
qulab/executor/storage.py,sha256=
|
14
|
+
qulab/executor/schedule.py,sha256=A5LOTFFJjU7zNEkv80hnq1cYGG-uPJYrhHO6KPY8pRg,16911
|
15
|
+
qulab/executor/storage.py,sha256=JH817-d6izBiz6wBGWvWxNEY_IPhRwRmGcB_eUpvE8U,11364
|
16
16
|
qulab/executor/transform.py,sha256=s0kxWQx8Sr9pMIQke1BLNM6KqrSogAkjB6Zkapl8YSU,2189
|
17
17
|
qulab/executor/utils.py,sha256=cF6-2jlvlHyTjNHdxXKG04Fjfm3_3wfDQAF1G8DQphk,5686
|
18
18
|
qulab/monitor/__init__.py,sha256=xEVDkJF8issrsDeLqQmDsvtRmrf-UiViFcGTWuzdlFU,43
|
@@ -94,9 +94,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
|
|
94
94
|
qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
|
95
95
|
qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
|
96
96
|
qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
|
97
|
-
QuLab-2.7.
|
98
|
-
QuLab-2.7.
|
99
|
-
QuLab-2.7.
|
100
|
-
QuLab-2.7.
|
101
|
-
QuLab-2.7.
|
102
|
-
QuLab-2.7.
|
97
|
+
QuLab-2.7.9.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
|
98
|
+
QuLab-2.7.9.dist-info/METADATA,sha256=nayB2CBp0e-8E_7hK5rw-hyIH14dVb1TmIl8w0CCu-E,3803
|
99
|
+
QuLab-2.7.9.dist-info/WHEEL,sha256=yNnHoQL2GZYIUXm9YvoaBpFjGlUoK9qq9oqYeudrWlE,101
|
100
|
+
QuLab-2.7.9.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
101
|
+
QuLab-2.7.9.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
102
|
+
QuLab-2.7.9.dist-info/RECORD,,
|
qulab/executor/schedule.py
CHANGED
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
7
7
|
from loguru import logger
|
8
8
|
|
9
9
|
from .load import WorkflowType, get_dependents
|
10
|
-
from .storage import (Report, find_report, get_heads, renew_report,
|
10
|
+
from .storage import (Report, find_report, get_head, get_heads, renew_report,
|
11
11
|
revoke_report, save_report)
|
12
12
|
from .transform import current_config, obey_the_oracle, update_parameters
|
13
13
|
|
@@ -120,42 +120,6 @@ def check_state(workflow: WorkflowType, code_path: str | Path,
|
|
120
120
|
return True
|
121
121
|
|
122
122
|
|
123
|
-
def call_analyzer(node: WorkflowType,
|
124
|
-
report: Report,
|
125
|
-
history: Report | None,
|
126
|
-
check=False,
|
127
|
-
plot=False) -> Report:
|
128
|
-
if check:
|
129
|
-
report = node.check_analyze(report, history=history)
|
130
|
-
veryfy_analyzed_report(report, node.__workflow_id__, "check_analyze")
|
131
|
-
report.fully_calibrated = False
|
132
|
-
else:
|
133
|
-
report = node.analyze(report, history=history)
|
134
|
-
veryfy_analyzed_report(report, node.__workflow_id__, "analyze")
|
135
|
-
if hasattr(node, 'oracle') and callable(node.oracle):
|
136
|
-
logger.debug(
|
137
|
-
f'"{node.__workflow_id__}" has oracle method, calling ...')
|
138
|
-
try:
|
139
|
-
report = node.oracle(report,
|
140
|
-
history=history,
|
141
|
-
system_state=get_heads(report.base_path))
|
142
|
-
except Exception as e:
|
143
|
-
logger.exception(e)
|
144
|
-
report.oracle = {}
|
145
|
-
if not isinstance(report, Report):
|
146
|
-
raise TypeError(
|
147
|
-
f'"{node.__workflow_id__}" : function "oracle" must return a Report object'
|
148
|
-
)
|
149
|
-
if not is_pickleable(report.oracle):
|
150
|
-
raise TypeError(
|
151
|
-
f'"{node.__workflow_id__}" : function "oracle" return not pickleable data'
|
152
|
-
)
|
153
|
-
report.fully_calibrated = True
|
154
|
-
if plot:
|
155
|
-
call_plot(node, report)
|
156
|
-
return report
|
157
|
-
|
158
|
-
|
159
123
|
@logger.catch()
|
160
124
|
def call_plot(node: WorkflowType, report: Report, check=False):
|
161
125
|
if hasattr(node, 'plot') and callable(node.plot):
|
@@ -177,12 +141,11 @@ def call_check(workflow: WorkflowType, session_id: str, state_path: Path):
|
|
177
141
|
data=data,
|
178
142
|
config_path=current_config(state_path),
|
179
143
|
base_path=state_path,
|
180
|
-
heads=get_heads(state_path)
|
144
|
+
heads=get_heads(state_path),
|
145
|
+
previous_path=get_head(workflow.__workflow_id__,
|
146
|
+
state_path))
|
181
147
|
|
182
|
-
save_report(workflow.__workflow_id__,
|
183
|
-
report,
|
184
|
-
state_path,
|
185
|
-
refresh_heads=False)
|
148
|
+
save_report(workflow.__workflow_id__, report, state_path)
|
186
149
|
|
187
150
|
set_cache(session_id, (workflow, 'check'), report)
|
188
151
|
return report
|
@@ -203,7 +166,9 @@ def call_calibrate(workflow: WorkflowType, session_id: str, state_path: Path):
|
|
203
166
|
data=data,
|
204
167
|
config_path=current_config(state_path),
|
205
168
|
base_path=state_path,
|
206
|
-
heads=get_heads(state_path)
|
169
|
+
heads=get_heads(state_path),
|
170
|
+
previous_path=get_head(workflow.__workflow_id__,
|
171
|
+
state_path))
|
207
172
|
|
208
173
|
save_report(workflow.__workflow_id__, report, state_path)
|
209
174
|
|
@@ -211,8 +176,60 @@ def call_calibrate(workflow: WorkflowType, session_id: str, state_path: Path):
|
|
211
176
|
return report
|
212
177
|
|
213
178
|
|
214
|
-
def
|
215
|
-
|
179
|
+
def call_check_analyzer(node: WorkflowType,
|
180
|
+
report: Report,
|
181
|
+
history: Report | None,
|
182
|
+
state_path: Path,
|
183
|
+
plot=False) -> Report:
|
184
|
+
report = node.check_analyze(report, history=history)
|
185
|
+
veryfy_analyzed_report(report, node.__workflow_id__, "check_analyze")
|
186
|
+
report.fully_calibrated = False
|
187
|
+
if report.in_spec:
|
188
|
+
logger.debug(
|
189
|
+
f'"{node.__workflow_id__}": checked in spec, renewing report')
|
190
|
+
renew_report(node.__workflow_id__, report.previous, state_path)
|
191
|
+
else:
|
192
|
+
logger.debug(
|
193
|
+
f'"{node.__workflow_id__}": checked out of spec, revoking report')
|
194
|
+
revoke_report(node.__workflow_id__, report.previous, state_path)
|
195
|
+
return report
|
196
|
+
|
197
|
+
|
198
|
+
def call_analyzer(node: WorkflowType,
|
199
|
+
report: Report,
|
200
|
+
history: Report | None,
|
201
|
+
state_path: Path,
|
202
|
+
plot=False) -> Report:
|
203
|
+
|
204
|
+
report = node.analyze(report, history=history)
|
205
|
+
veryfy_analyzed_report(report, node.__workflow_id__, "analyze")
|
206
|
+
if hasattr(node, 'oracle') and callable(node.oracle):
|
207
|
+
logger.debug(
|
208
|
+
f'"{node.__workflow_id__}" has oracle method, calling ...')
|
209
|
+
try:
|
210
|
+
report = node.oracle(report,
|
211
|
+
history=history,
|
212
|
+
system_state=get_heads(report.base_path))
|
213
|
+
except Exception as e:
|
214
|
+
logger.exception(e)
|
215
|
+
report.oracle = {}
|
216
|
+
if not isinstance(report, Report):
|
217
|
+
raise TypeError(
|
218
|
+
f'"{node.__workflow_id__}" : function "oracle" must return a Report object'
|
219
|
+
)
|
220
|
+
if not is_pickleable(report.oracle):
|
221
|
+
raise TypeError(
|
222
|
+
f'"{node.__workflow_id__}" : function "oracle" return not pickleable data'
|
223
|
+
)
|
224
|
+
report.fully_calibrated = True
|
225
|
+
save_report(node.__workflow_id__, report, state_path, overwrite=True)
|
226
|
+
if plot:
|
227
|
+
call_plot(node, report)
|
228
|
+
return report
|
229
|
+
|
230
|
+
|
231
|
+
def check_data(workflow: WorkflowType, state_path: str | Path, plot: bool,
|
232
|
+
session_id: str) -> Report:
|
216
233
|
"""
|
217
234
|
check data answers two questions:
|
218
235
|
Is the parameter associated with this cal in spec,
|
@@ -225,7 +242,9 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
225
242
|
report = Report(workflow=workflow.__workflow_id__,
|
226
243
|
config_path=current_config(state_path),
|
227
244
|
base_path=state_path,
|
228
|
-
heads=get_heads(state_path)
|
245
|
+
heads=get_heads(state_path),
|
246
|
+
previous_path=get_head(workflow.__workflow_id__,
|
247
|
+
state_path))
|
229
248
|
report.in_spec = False
|
230
249
|
report.bad_data = False
|
231
250
|
return report
|
@@ -250,21 +269,11 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
250
269
|
report = call_check(workflow, session_id, state_path)
|
251
270
|
|
252
271
|
logger.debug(f'Checked "{workflow.__workflow_id__}" !')
|
253
|
-
report =
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
if report.in_spec:
|
259
|
-
logger.debug(
|
260
|
-
f'"{workflow.__workflow_id__}": checked in spec, renewing report'
|
261
|
-
)
|
262
|
-
renew_report(workflow.__workflow_id__, report, state_path)
|
263
|
-
else:
|
264
|
-
logger.debug(
|
265
|
-
f'"{workflow.__workflow_id__}": checked out of spec, revoking report'
|
266
|
-
)
|
267
|
-
revoke_report(workflow.__workflow_id__, report, state_path)
|
272
|
+
report = call_check_analyzer(workflow,
|
273
|
+
report,
|
274
|
+
history,
|
275
|
+
state_path,
|
276
|
+
plot=plot)
|
268
277
|
else:
|
269
278
|
logger.debug(
|
270
279
|
f'Checking "{workflow.__workflow_id__}" with "calibrate" method ...'
|
@@ -276,17 +285,13 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
276
285
|
report = call_analyzer(workflow,
|
277
286
|
report,
|
278
287
|
history,
|
279
|
-
|
288
|
+
state_path,
|
280
289
|
plot=plot)
|
281
|
-
save_report(workflow.__workflow_id__,
|
282
|
-
report,
|
283
|
-
state_path,
|
284
|
-
overwrite=True)
|
285
290
|
return report
|
286
291
|
|
287
292
|
|
288
|
-
def calibrate(workflow: WorkflowType,
|
289
|
-
|
293
|
+
def calibrate(workflow: WorkflowType, state_path: str | Path, plot: bool,
|
294
|
+
session_id: str) -> Report:
|
290
295
|
history = find_report(workflow.__workflow_id__, state_path)
|
291
296
|
|
292
297
|
logger.debug(f'Calibrating "{workflow.__workflow_id__}" ...')
|
@@ -295,9 +300,11 @@ def calibrate(workflow: WorkflowType, code_path: str | Path,
|
|
295
300
|
|
296
301
|
logger.debug(f'Calibrated "{workflow.__workflow_id__}" !')
|
297
302
|
|
298
|
-
report = call_analyzer(workflow,
|
299
|
-
|
300
|
-
|
303
|
+
report = call_analyzer(workflow,
|
304
|
+
report,
|
305
|
+
history,
|
306
|
+
state_path,
|
307
|
+
plot=plot)
|
301
308
|
return report
|
302
309
|
|
303
310
|
|
@@ -308,7 +315,7 @@ def diagnose(workflow: WorkflowType, code_path: str | Path,
|
|
308
315
|
'''
|
309
316
|
logger.debug(f'diagnose "{workflow.__workflow_id__}"')
|
310
317
|
# check_data
|
311
|
-
report = check_data(workflow,
|
318
|
+
report = check_data(workflow, state_path, plot, session_id)
|
312
319
|
# in spec case
|
313
320
|
if report.in_spec:
|
314
321
|
logger.debug(
|
@@ -350,7 +357,7 @@ def diagnose(workflow: WorkflowType, code_path: str | Path,
|
|
350
357
|
else:
|
351
358
|
logger.error(f'Never reach: recalibrate "{workflow.__workflow_id__}"')
|
352
359
|
|
353
|
-
report = calibrate(workflow,
|
360
|
+
report = calibrate(workflow, state_path, plot, session_id)
|
354
361
|
if report.bad_data or not report.in_spec:
|
355
362
|
obey_the_oracle(report, state_path)
|
356
363
|
raise CalibrationFailedError(
|
@@ -393,7 +400,7 @@ def maintain(workflow: WorkflowType,
|
|
393
400
|
f'"{workflow.__workflow_id__}": In spec, no need to maintain')
|
394
401
|
return
|
395
402
|
# check_data
|
396
|
-
report = check_data(workflow,
|
403
|
+
report = check_data(workflow, state_path, plot, session_id)
|
397
404
|
if report.in_spec:
|
398
405
|
if not run:
|
399
406
|
logger.debug(
|
@@ -412,7 +419,7 @@ def maintain(workflow: WorkflowType,
|
|
412
419
|
f'"{workflow.__workflow_id__}": All dependents diagnosed')
|
413
420
|
# calibrate
|
414
421
|
logger.debug(f'recalibrate "{workflow.__workflow_id__}"')
|
415
|
-
report = calibrate(workflow,
|
422
|
+
report = calibrate(workflow, state_path, plot, session_id)
|
416
423
|
if report.bad_data or not report.in_spec:
|
417
424
|
if not freeze:
|
418
425
|
obey_the_oracle(report, state_path)
|
@@ -432,11 +439,7 @@ def run(workflow: WorkflowType,
|
|
432
439
|
freeze: bool = False):
|
433
440
|
session_id = uuid.uuid4().hex
|
434
441
|
logger.debug(f'run "{workflow.__workflow_id__}" without dependences.')
|
435
|
-
report = calibrate(workflow,
|
436
|
-
code_path,
|
437
|
-
state_path,
|
438
|
-
plot,
|
439
|
-
session_id=session_id)
|
442
|
+
report = calibrate(workflow, state_path, plot, session_id=session_id)
|
440
443
|
if report.bad_data or not report.in_spec:
|
441
444
|
if not freeze:
|
442
445
|
obey_the_oracle(report, state_path)
|
qulab/executor/storage.py
CHANGED
@@ -149,8 +149,11 @@ def save_report(workflow: str,
|
|
149
149
|
f'Saving report for "{workflow}", {report.in_spec=}, {report.bad_data=}, {report.fully_calibrated=}'
|
150
150
|
)
|
151
151
|
base_path = Path(base_path)
|
152
|
-
|
152
|
+
try:
|
153
153
|
buf = lzma.compress(pickle.dumps(report))
|
154
|
+
except:
|
155
|
+
raise ValueError(f"Can't pickle report for {workflow}")
|
156
|
+
if overwrite:
|
154
157
|
path = report.path
|
155
158
|
if path is None:
|
156
159
|
raise ValueError("Report path is None, can't overwrite.")
|
@@ -158,8 +161,6 @@ def save_report(workflow: str,
|
|
158
161
|
index = int.from_bytes(f.read(8), 'big')
|
159
162
|
report.index = index
|
160
163
|
else:
|
161
|
-
report.previous_path = get_head(workflow, base_path)
|
162
|
-
buf = lzma.compress(pickle.dumps(report))
|
163
164
|
path = random_path(base_path / 'objects')
|
164
165
|
(base_path / 'objects' / path).parent.mkdir(parents=True,
|
165
166
|
exist_ok=True)
|
@@ -168,7 +169,6 @@ def save_report(workflow: str,
|
|
168
169
|
base_path,
|
169
170
|
context=str(path),
|
170
171
|
width=35)
|
171
|
-
|
172
172
|
with open(base_path / 'objects' / path, "wb") as f:
|
173
173
|
f.write(report.index.to_bytes(8, 'big'))
|
174
174
|
f.write(buf)
|
@@ -202,22 +202,30 @@ def find_report(
|
|
202
202
|
return load_report(path, base_path)
|
203
203
|
|
204
204
|
|
205
|
-
def renew_report(workflow: str, report, base_path: str | Path):
|
205
|
+
def renew_report(workflow: str, report: Report | None, base_path: str | Path):
|
206
206
|
logger.debug(f'Renewing report for "{workflow}"')
|
207
|
-
report = find_report(workflow, base_path)
|
208
207
|
if report is not None:
|
209
208
|
report.checked_time = datetime.now()
|
210
|
-
return save_report(workflow,
|
209
|
+
return save_report(workflow,
|
210
|
+
report,
|
211
|
+
base_path,
|
212
|
+
overwrite=True,
|
213
|
+
refresh_heads=True)
|
214
|
+
else:
|
215
|
+
raise ValueError(f"Can't renew report for {workflow}")
|
211
216
|
|
212
217
|
|
213
|
-
def revoke_report(workflow: str, report, base_path: str | Path):
|
218
|
+
def revoke_report(workflow: str, report: Report | None, base_path: str | Path):
|
214
219
|
logger.debug(f'Revoking report for "{workflow}"')
|
215
220
|
base_path = Path(base_path)
|
216
|
-
|
217
|
-
if path is not None:
|
218
|
-
report = load_report(path, base_path)
|
221
|
+
if report is not None:
|
219
222
|
report.in_spec = False
|
220
|
-
|
223
|
+
report.previous_path = report.path
|
224
|
+
return save_report(workflow,
|
225
|
+
report,
|
226
|
+
base_path,
|
227
|
+
overwrite=False,
|
228
|
+
refresh_heads=True)
|
221
229
|
|
222
230
|
|
223
231
|
def set_head(workflow: str, path: Path, base_path: str | Path):
|
qulab/fun.cp311-win_amd64.pyd
CHANGED
Binary file
|
qulab/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.7.
|
1
|
+
__version__ = "2.7.9"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|