QuLab 2.4.15__cp312-cp312-macosx_10_13_universal2.whl → 2.4.17__cp312-cp312-macosx_10_13_universal2.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.15.dist-info → QuLab-2.4.17.dist-info}/METADATA +1 -1
- {QuLab-2.4.15.dist-info → QuLab-2.4.17.dist-info}/RECORD +11 -11
- qulab/executor/cli.py +9 -0
- qulab/executor/load.py +27 -8
- qulab/executor/utils.py +2 -2
- qulab/fun.cpython-312-darwin.so +0 -0
- qulab/version.py +1 -1
- {QuLab-2.4.15.dist-info → QuLab-2.4.17.dist-info}/LICENSE +0 -0
- {QuLab-2.4.15.dist-info → QuLab-2.4.17.dist-info}/WHEEL +0 -0
- {QuLab-2.4.15.dist-info → QuLab-2.4.17.dist-info}/entry_points.txt +0 -0
- {QuLab-2.4.15.dist-info → QuLab-2.4.17.dist-info}/top_level.txt +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
qulab/__init__.py,sha256=P-Mx2p4TVmL91SoxoeXcj8Qm0x4xUf5Q_FLk0Yc_gIQ,138
|
|
2
2
|
qulab/__main__.py,sha256=JgErYkiskih8Y6oRwowALtR-rwQhAAdqOYWjQraRIPI,59
|
|
3
3
|
qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
|
|
4
|
-
qulab/fun.cpython-312-darwin.so,sha256=
|
|
5
|
-
qulab/version.py,sha256=
|
|
4
|
+
qulab/fun.cpython-312-darwin.so,sha256=VRYtRfEafLRrUFTW423zgNJz_TWbisQP5_mtP33xBug,126864
|
|
5
|
+
qulab/version.py,sha256=7sdjAp5MKcoRwUjjN0nAZGMtB3lz4cfXjSGNTq8NnJ4,22
|
|
6
6
|
qulab/cli/__init__.py,sha256=tgDIkkeIoasQXAifJZ6NU8jDgpNgb2a-B0C4nF0evrE,559
|
|
7
7
|
qulab/cli/config.py,sha256=QksTYD3-RBYBG8xnKLAh7EXrNOwxr128XXr30ZTFW6A,2983
|
|
8
8
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
|
9
|
-
qulab/executor/cli.py,sha256=
|
|
10
|
-
qulab/executor/load.py,sha256=
|
|
9
|
+
qulab/executor/cli.py,sha256=9x7yCvEI41MaALE5Hv9-15Z_IGs2_Kswo3EjCoh_RPE,5595
|
|
10
|
+
qulab/executor/load.py,sha256=eKysHL5EHKd_YcfHOVwRoaNsD-k0cTuxDY_7Yn5W8hA,11078
|
|
11
11
|
qulab/executor/schedule.py,sha256=SfMZys8WdmIvfW5fPM42g-F6XwewTdpC0-puhf5TA54,11721
|
|
12
12
|
qulab/executor/storage.py,sha256=M66Q5_Uc5MMfc_QAuuaaexwAz7wxBPMkeleB5nRpQmI,4621
|
|
13
13
|
qulab/executor/transform.py,sha256=inaOn6eqCs22ZZ0xAQl8s8YCoEACaXSwFNNu7jqdwAk,2148
|
|
14
|
-
qulab/executor/utils.py,sha256=
|
|
14
|
+
qulab/executor/utils.py,sha256=RmnT0wMTAvavM-abgFt2tQN8TaaHuk86-YAiOUQCoBU,3101
|
|
15
15
|
qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
|
|
16
16
|
qulab/monitor/__main__.py,sha256=w3yUcqq195LzSnXTkQcuC1RSFRhy4oQ_PEBmucXguME,97
|
|
17
17
|
qulab/monitor/config.py,sha256=fQ5JcsMApKc1UwANEnIvbDQZl8uYW0tle92SaYtX9lI,744
|
|
@@ -91,9 +91,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
|
|
|
91
91
|
qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
|
|
92
92
|
qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
|
|
93
93
|
qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
|
|
94
|
-
QuLab-2.4.
|
|
95
|
-
QuLab-2.4.
|
|
96
|
-
QuLab-2.4.
|
|
97
|
-
QuLab-2.4.
|
|
98
|
-
QuLab-2.4.
|
|
99
|
-
QuLab-2.4.
|
|
94
|
+
QuLab-2.4.17.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
|
|
95
|
+
QuLab-2.4.17.dist-info/METADATA,sha256=dAJd-BCvDEyHIZiHvmLE4OPr1FuPeEzimYABjdgkCrw,3699
|
|
96
|
+
QuLab-2.4.17.dist-info/WHEEL,sha256=iDXcyuxg-66TzzqHGH-kgw_HJdaJE_1RHznrvPNCSNs,115
|
|
97
|
+
QuLab-2.4.17.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
|
98
|
+
QuLab-2.4.17.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
|
99
|
+
QuLab-2.4.17.dist-info/RECORD,,
|
qulab/executor/cli.py
CHANGED
|
@@ -54,6 +54,7 @@ def create(workflow, code):
|
|
|
54
54
|
"""
|
|
55
55
|
Create a new workflow file.
|
|
56
56
|
"""
|
|
57
|
+
logger.info(f'[CMD]: create {workflow} --code {code}')
|
|
57
58
|
if code is None:
|
|
58
59
|
code = Path.cwd()
|
|
59
60
|
|
|
@@ -82,6 +83,7 @@ def set(key, value, api):
|
|
|
82
83
|
"""
|
|
83
84
|
Set a config.
|
|
84
85
|
"""
|
|
86
|
+
logger.info(f'[CMD]: set {key} {value} --api {api}')
|
|
85
87
|
from . import transform
|
|
86
88
|
if api is not None:
|
|
87
89
|
api = importlib.import_module(api)
|
|
@@ -103,6 +105,7 @@ def get(key, api):
|
|
|
103
105
|
"""
|
|
104
106
|
Get a config.
|
|
105
107
|
"""
|
|
108
|
+
logger.info(f'[CMD]: get {key} --api {api}')
|
|
106
109
|
from . import transform
|
|
107
110
|
if api is not None:
|
|
108
111
|
api = importlib.import_module(api)
|
|
@@ -123,6 +126,9 @@ def run(workflow, code, data, api, plot, no_dependents):
|
|
|
123
126
|
"""
|
|
124
127
|
Run a workflow.
|
|
125
128
|
"""
|
|
129
|
+
logger.info(
|
|
130
|
+
f'[CMD]: run {workflow} --code {code} --data {data} --api {api} --plot {plot} --no-dependents {no_dependents}'
|
|
131
|
+
)
|
|
126
132
|
if api is not None:
|
|
127
133
|
api = importlib.import_module(api)
|
|
128
134
|
set_config_api(api.query_config, api.update_config)
|
|
@@ -159,6 +165,9 @@ def maintain(workflow, code, data, api, plot):
|
|
|
159
165
|
"""
|
|
160
166
|
Maintain a workflow.
|
|
161
167
|
"""
|
|
168
|
+
logger.info(
|
|
169
|
+
f'[CMD]: maintain {workflow} --code {code} --data {data} --api {api} --plot {plot}'
|
|
170
|
+
)
|
|
162
171
|
if api is not None:
|
|
163
172
|
api = importlib.import_module(api)
|
|
164
173
|
set_config_api(api.query_config, api.update_config)
|
qulab/executor/load.py
CHANGED
|
@@ -15,12 +15,13 @@ from .storage import Result
|
|
|
15
15
|
|
|
16
16
|
class SetConfigWorkflow():
|
|
17
17
|
__timeout__ = None
|
|
18
|
+
__mtime__ = 0
|
|
18
19
|
|
|
19
20
|
def __init__(self, key):
|
|
20
21
|
self.key = key
|
|
21
22
|
|
|
22
23
|
def depends(self):
|
|
23
|
-
return [
|
|
24
|
+
return []
|
|
24
25
|
|
|
25
26
|
def check_state(self, history: Result) -> bool:
|
|
26
27
|
from . import transform
|
|
@@ -200,10 +201,13 @@ def load_workflow_from_file(file_name: str,
|
|
|
200
201
|
package='workflows') -> WorkflowType:
|
|
201
202
|
base_path = Path(base_path)
|
|
202
203
|
path = Path(file_name)
|
|
204
|
+
if not (base_path / path).exists():
|
|
205
|
+
raise FileNotFoundError(f"File not found: {base_path / path}")
|
|
203
206
|
module_name = f"{package}.{'.'.join([*path.parts[:-1], path.stem])}"
|
|
204
207
|
spec = spec_from_file_location(module_name, base_path / path)
|
|
205
208
|
module = module_from_spec(spec)
|
|
206
209
|
spec.loader.exec_module(module)
|
|
210
|
+
module.__mtime__ = (base_path / path).stat().st_mtime
|
|
207
211
|
|
|
208
212
|
if hasattr(module, 'entries'):
|
|
209
213
|
return module
|
|
@@ -224,13 +228,16 @@ def load_workflow_from_template(template_path: str,
|
|
|
224
228
|
mappping: dict[str, str],
|
|
225
229
|
base_path: str | Path,
|
|
226
230
|
target_path: str | None = None,
|
|
227
|
-
package='workflows'
|
|
231
|
+
package='workflows',
|
|
232
|
+
mtime: float = 0) -> WorkflowType:
|
|
228
233
|
base_path = Path(base_path)
|
|
229
234
|
path = Path(template_path)
|
|
230
235
|
|
|
231
236
|
with open(base_path / path) as f:
|
|
232
237
|
content = f.read()
|
|
233
238
|
|
|
239
|
+
mtime = max(Path(template_path).stat().st_mtime, mtime)
|
|
240
|
+
|
|
234
241
|
def replace(text):
|
|
235
242
|
"""
|
|
236
243
|
将给定文本中的所有 _D_("var") 替换为 ${var}。
|
|
@@ -247,6 +254,10 @@ def load_workflow_from_template(template_path: str,
|
|
|
247
254
|
return new_text
|
|
248
255
|
|
|
249
256
|
template = string.Template(replace(content))
|
|
257
|
+
keys = template.get_identifiers()
|
|
258
|
+
missing = set(keys) - set(mappping.keys())
|
|
259
|
+
if missing:
|
|
260
|
+
raise KeyError(f"{template_path}: Missing keys in mapping: {missing}")
|
|
250
261
|
content = template.substitute(mappping)
|
|
251
262
|
|
|
252
263
|
hash_str = hashlib.md5(pickle.dumps(mappping)).hexdigest()[:8]
|
|
@@ -267,7 +278,7 @@ def load_workflow_from_template(template_path: str,
|
|
|
267
278
|
with open(file, 'w') as f:
|
|
268
279
|
f.write(content)
|
|
269
280
|
else:
|
|
270
|
-
if file.stat().st_mtime <
|
|
281
|
+
if file.stat().st_mtime < mtime:
|
|
271
282
|
with open(file, 'w') as f:
|
|
272
283
|
f.write(content)
|
|
273
284
|
else:
|
|
@@ -277,22 +288,24 @@ def load_workflow_from_template(template_path: str,
|
|
|
277
288
|
)
|
|
278
289
|
|
|
279
290
|
module = load_workflow_from_file(str(path), base_path, package)
|
|
291
|
+
module.__mtime__ = max(mtime, module.__mtime__)
|
|
280
292
|
|
|
281
293
|
return module
|
|
282
294
|
|
|
283
295
|
|
|
284
296
|
def load_workflow(workflow: str | tuple[str, dict],
|
|
285
297
|
base_path: str | Path,
|
|
286
|
-
package='workflows'
|
|
298
|
+
package='workflows',
|
|
299
|
+
mtime: float = 0) -> WorkflowType:
|
|
287
300
|
if isinstance(workflow, tuple):
|
|
288
301
|
if len(workflow) == 2:
|
|
289
302
|
file_name, mapping = workflow
|
|
290
303
|
w = load_workflow_from_template(file_name, mapping, base_path,
|
|
291
|
-
None, package)
|
|
304
|
+
None, package, mtime)
|
|
292
305
|
elif len(workflow) == 3:
|
|
293
306
|
template_path, target_path, mapping = workflow
|
|
294
307
|
w = load_workflow_from_template(template_path, mapping, base_path,
|
|
295
|
-
target_path, package)
|
|
308
|
+
target_path, package, mtime)
|
|
296
309
|
else:
|
|
297
310
|
raise ValueError(f"Invalid workflow: {workflow}")
|
|
298
311
|
w.__workflow_id__ = str(Path(w.__file__).relative_to(base_path))
|
|
@@ -312,8 +325,14 @@ def load_workflow(workflow: str | tuple[str, dict],
|
|
|
312
325
|
|
|
313
326
|
def get_dependents(workflow: WorkflowType,
|
|
314
327
|
code_path: str | Path) -> list[WorkflowType]:
|
|
315
|
-
return [
|
|
328
|
+
return [
|
|
329
|
+
load_workflow(n, code_path, mtime=workflow.__mtime__)
|
|
330
|
+
for n in workflow.depends()
|
|
331
|
+
]
|
|
316
332
|
|
|
317
333
|
|
|
318
334
|
def get_entries(workflow: WorkflowType, code_path: str | Path) -> WorkflowType:
|
|
319
|
-
return [
|
|
335
|
+
return [
|
|
336
|
+
load_workflow(n, code_path, mtime=workflow.__mtime__)
|
|
337
|
+
for n in workflow.entries()
|
|
338
|
+
]
|
qulab/executor/utils.py
CHANGED
|
@@ -25,7 +25,7 @@ def dependent_tree(node: str, code_path: str | Path) -> dict[str, list[str]]:
|
|
|
25
25
|
Returns a dict of nodes and their dependents.
|
|
26
26
|
'''
|
|
27
27
|
tree = {}
|
|
28
|
-
for n in load_workflow(node, code_path).depends()
|
|
28
|
+
for n in load_workflow(node, code_path).depends():
|
|
29
29
|
tree[n] = dependent_tree(n, code_path)
|
|
30
30
|
return tree
|
|
31
31
|
|
|
@@ -43,7 +43,7 @@ import numpy as np
|
|
|
43
43
|
__timeout__ = 7*24*3600
|
|
44
44
|
|
|
45
45
|
def depends():
|
|
46
|
-
return
|
|
46
|
+
return {deps!r}
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def calibrate():
|
qulab/fun.cpython-312-darwin.so
CHANGED
|
Binary file
|
qulab/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.4.
|
|
1
|
+
__version__ = "2.4.17"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|