QuLab 2.4.12__cp310-cp310-win_amd64.whl → 2.4.14__cp310-cp310-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.12.dist-info → QuLab-2.4.14.dist-info}/METADATA +1 -1
- {QuLab-2.4.12.dist-info → QuLab-2.4.14.dist-info}/RECORD +11 -11
- qulab/executor/load.py +48 -16
- qulab/executor/schedule.py +3 -7
- qulab/executor/utils.py +2 -0
- qulab/fun.cp310-win_amd64.pyd +0 -0
- qulab/version.py +1 -1
- {QuLab-2.4.12.dist-info → QuLab-2.4.14.dist-info}/LICENSE +0 -0
- {QuLab-2.4.12.dist-info → QuLab-2.4.14.dist-info}/WHEEL +0 -0
- {QuLab-2.4.12.dist-info → QuLab-2.4.14.dist-info}/entry_points.txt +0 -0
- {QuLab-2.4.12.dist-info → QuLab-2.4.14.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=vUnluugYF1cH2UA44odFW1Z4AKecBZIfAihvsbhhSe0,629
|
3
3
|
qulab/dicttree.py,sha256=ZoSJVWK4VMqfzj42gPb_n5RqLlM6K1Me0WmLIfLEYf8,14195
|
4
|
-
qulab/fun.cp310-win_amd64.pyd,sha256=
|
5
|
-
qulab/version.py,sha256=
|
4
|
+
qulab/fun.cp310-win_amd64.pyd,sha256=UYlwuWIM6wHQzBVChDCW2SoTcIq6GeLlXU0eyeYi-P0,31232
|
5
|
+
qulab/version.py,sha256=IPQCIOITfbX8l3dhIiuTYy89V7yOtf70dflfUCn6Dgk,22
|
6
6
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
7
7
|
qulab/executor/__main__.py,sha256=qgZcdmx1wBZInHf6ionpuuZytIJnaDje9WRv-a8o2OM,5870
|
8
|
-
qulab/executor/load.py,sha256=
|
9
|
-
qulab/executor/schedule.py,sha256=
|
8
|
+
qulab/executor/load.py,sha256=WNpJmHAxXaQKPkmycsqbqeuAuiudNi-4GscmBKfdKlw,9713
|
9
|
+
qulab/executor/schedule.py,sha256=SfMZys8WdmIvfW5fPM42g-F6XwewTdpC0-puhf5TA54,11721
|
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=jp3F0swO9gpKhmTauxbgEK9WVorjI9FAL6zT60cYTdk,3106
|
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.14.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
|
93
|
+
QuLab-2.4.14.dist-info/METADATA,sha256=37tzAZ4vAtg_Jf8j4qWlL6uXf8DmPfztQdyfQ0TUoTk,3804
|
94
|
+
QuLab-2.4.14.dist-info/WHEEL,sha256=rzGfZgUcGeKSgIHGYMuqg4xE4VPHxnaldXH6BG0zjVk,101
|
95
|
+
QuLab-2.4.14.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
96
|
+
QuLab-2.4.14.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
97
|
+
QuLab-2.4.14.dist-info/RECORD,,
|
qulab/executor/load.py
CHANGED
@@ -128,15 +128,15 @@ def find_unreferenced_workflows(path: str) -> list[str]:
|
|
128
128
|
for file_path in root.rglob("*.py"):
|
129
129
|
if file_path.name == "__init__.py":
|
130
130
|
continue
|
131
|
-
if file_path.name.
|
132
|
-
|
131
|
+
if file_path.name == 'template.py' or file_path.name.endswith(
|
132
|
+
"_template.py"):
|
133
133
|
continue
|
134
134
|
try:
|
135
135
|
rel_path = file_path.relative_to(root)
|
136
136
|
except ValueError:
|
137
137
|
continue
|
138
138
|
|
139
|
-
module =
|
139
|
+
module = load_workflow_from_file(str(rel_path), root)
|
140
140
|
|
141
141
|
if is_workflow(module):
|
142
142
|
rel_str = str(rel_path)
|
@@ -147,7 +147,7 @@ def find_unreferenced_workflows(path: str) -> list[str]:
|
|
147
147
|
|
148
148
|
# Check dependencies for each workflow module
|
149
149
|
for rel_str in workflows:
|
150
|
-
module =
|
150
|
+
module = load_workflow_from_file(rel_str, root)
|
151
151
|
|
152
152
|
depends_func = getattr(module, "depends", None)
|
153
153
|
if depends_func and callable(depends_func):
|
@@ -157,7 +157,9 @@ def find_unreferenced_workflows(path: str) -> list[str]:
|
|
157
157
|
)
|
158
158
|
continue
|
159
159
|
try:
|
160
|
-
depends_list =
|
160
|
+
depends_list = [
|
161
|
+
n.__workflow_id__ for n in get_dependents(module, root)
|
162
|
+
]
|
161
163
|
except Exception as e:
|
162
164
|
warnings.warn(f"Error calling depends() in {rel_str}: {e}")
|
163
165
|
continue
|
@@ -183,9 +185,9 @@ def find_unreferenced_workflows(path: str) -> list[str]:
|
|
183
185
|
return unreferenced
|
184
186
|
|
185
187
|
|
186
|
-
def
|
187
|
-
|
188
|
-
|
188
|
+
def load_workflow_from_file(file_name: str,
|
189
|
+
base_path: str | Path,
|
190
|
+
package='workflows') -> WorkflowType:
|
189
191
|
if file_name.startswith('cfg:'):
|
190
192
|
return SetConfigWorkflow(file_name[4:])
|
191
193
|
base_path = Path(base_path)
|
@@ -217,20 +219,45 @@ def load_workflow_from_template(file_name: str,
|
|
217
219
|
|
218
220
|
with open(base_path / path) as f:
|
219
221
|
content = f.read()
|
220
|
-
|
222
|
+
|
223
|
+
def replace(text):
|
224
|
+
"""
|
225
|
+
将给定文本中的所有 _D_("var") 替换为 ${var}。
|
226
|
+
|
227
|
+
Args:
|
228
|
+
text (str): 包含 _D_ 调用的字符串。
|
229
|
+
|
230
|
+
Returns:
|
231
|
+
str: 已经替换的新字符串。
|
232
|
+
"""
|
233
|
+
pattern = re.compile(r'_D_\s*\(\s*(["\'])(\w+)\1\s*\)')
|
234
|
+
replacement = r'${\2}'
|
235
|
+
new_text = re.sub(pattern, replacement, text)
|
236
|
+
return new_text
|
237
|
+
|
238
|
+
template = string.Template(replace(content))
|
221
239
|
content = template.substitute(mappping)
|
222
240
|
|
223
241
|
hash_str = hashlib.md5(pickle.dumps(mappping)).hexdigest()[:8]
|
224
242
|
if subtitle is None:
|
225
|
-
|
226
|
-
|
243
|
+
if path.stem == 'template':
|
244
|
+
path = path.parent / f'tmp{hash_str}.py'
|
245
|
+
else:
|
246
|
+
path = path.parent / path.stem.replace('_template',
|
247
|
+
f'_tmp{hash_str}.py')
|
227
248
|
else:
|
228
|
-
|
249
|
+
if path.stem == 'template':
|
250
|
+
path = path.parent / f'{subtitle}.py'
|
251
|
+
else:
|
252
|
+
path = path.parent / path.stem.replace('_template',
|
253
|
+
f'_{subtitle}.py')
|
229
254
|
|
230
|
-
|
231
|
-
|
255
|
+
file = base_path / path
|
256
|
+
if not file.exists():
|
257
|
+
with open(file, 'w') as f:
|
258
|
+
f.write(content)
|
232
259
|
|
233
|
-
module =
|
260
|
+
module = load_workflow_from_file(str(path), base_path, package)
|
234
261
|
|
235
262
|
return module
|
236
263
|
|
@@ -256,9 +283,14 @@ def load_workflow(workflow: str | tuple[str, dict],
|
|
256
283
|
w = SetConfigWorkflow(key)
|
257
284
|
w.__workflow_id__ = workflow
|
258
285
|
else:
|
259
|
-
w =
|
286
|
+
w = load_workflow_from_file(workflow, base_path, package)
|
260
287
|
w.__workflow_id__ = str(Path(w.__file__).relative_to(base_path))
|
261
288
|
else:
|
262
289
|
raise TypeError(f"Invalid workflow: {workflow}")
|
263
290
|
|
264
291
|
return w
|
292
|
+
|
293
|
+
|
294
|
+
def get_dependents(workflow: WorkflowType,
|
295
|
+
code_path: str | Path) -> list[WorkflowType]:
|
296
|
+
return [load_workflow(n, code_path) for n in workflow.depends()[0]]
|
qulab/executor/schedule.py
CHANGED
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
6
6
|
from loguru import logger
|
7
7
|
|
8
8
|
from . import transform
|
9
|
-
from .load import WorkflowType,
|
9
|
+
from .load import WorkflowType, get_dependents
|
10
10
|
from .storage import (Result, find_result, get_head, renew_result,
|
11
11
|
revoke_result, save_result)
|
12
12
|
|
@@ -230,11 +230,6 @@ def diagnose(workflow: WorkflowType, code_path: str | Path,
|
|
230
230
|
return True
|
231
231
|
|
232
232
|
|
233
|
-
def get_dependents(workflow: WorkflowType,
|
234
|
-
code_path: str | Path) -> list[WorkflowType]:
|
235
|
-
return [load_workflow(n, code_path) for n in workflow.depends()[0]]
|
236
|
-
|
237
|
-
|
238
233
|
@logger.catch(reraise=True)
|
239
234
|
def maintain(workflow: WorkflowType,
|
240
235
|
code_path: str | Path,
|
@@ -294,8 +289,9 @@ def run(workflow: WorkflowType,
|
|
294
289
|
code_path: str | Path,
|
295
290
|
state_path: str | Path,
|
296
291
|
plot: bool = False):
|
292
|
+
session_id = uuid.uuid4().hex
|
297
293
|
logger.debug(f'run "{workflow.__workflow_id__}" without dependences.')
|
298
|
-
result = calibrate(workflow, code_path, state_path, plot)
|
294
|
+
result = calibrate(workflow, code_path, state_path, plot, session_id=session_id)
|
299
295
|
if result.bad_data or not result.in_spec:
|
300
296
|
raise CalibrationFailedError(
|
301
297
|
f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
|
qulab/executor/utils.py
CHANGED
qulab/fun.cp310-win_amd64.pyd
CHANGED
Binary file
|
qulab/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.4.
|
1
|
+
__version__ = "2.4.14"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|