QuLab 2.7.4__cp312-cp312-macosx_10_13_universal2.whl → 2.7.6__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.7.4.dist-info → QuLab-2.7.6.dist-info}/METADATA +1 -1
- {QuLab-2.7.4.dist-info → QuLab-2.7.6.dist-info}/RECORD +12 -12
- qulab/executor/cli.py +1 -0
- qulab/executor/load.py +3 -0
- qulab/executor/schedule.py +53 -6
- qulab/executor/storage.py +25 -14
- qulab/fun.cpython-312-darwin.so +0 -0
- qulab/version.py +1 -1
- {QuLab-2.7.4.dist-info → QuLab-2.7.6.dist-info}/LICENSE +0 -0
- {QuLab-2.7.4.dist-info → QuLab-2.7.6.dist-info}/WHEEL +0 -0
- {QuLab-2.7.4.dist-info → QuLab-2.7.6.dist-info}/entry_points.txt +0 -0
- {QuLab-2.7.4.dist-info → QuLab-2.7.6.dist-info}/top_level.txt +0 -0
@@ -1,18 +1,18 @@
|
|
1
1
|
qulab/__init__.py,sha256=tKRZe2WafDGcwbu7ddlMaePerN842aRbxcrECsu5pas,286
|
2
2
|
qulab/__main__.py,sha256=fjaRSL_uUjNIzBGNgjlGswb9TJ2VD5qnkZHW3hItrD4,68
|
3
3
|
qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
|
4
|
-
qulab/fun.cpython-312-darwin.so,sha256=
|
4
|
+
qulab/fun.cpython-312-darwin.so,sha256=PDl9H0nZgPXERCUMjl2wFO12OlRlvFuTa6iKUOjtk4U,126864
|
5
5
|
qulab/typing.py,sha256=5xCLfrp1aZpKpDy4p2arbFszw2eK3hGUjZa-XSvC_-8,69
|
6
6
|
qulab/utils.py,sha256=JIXMSmZU0uYfKG_tzawpK7vRNPRir_hJE8JlqkVLX2o,1260
|
7
|
-
qulab/version.py,sha256=
|
7
|
+
qulab/version.py,sha256=ElxLmcD9H2GsJrWa-NsuGSxQyl8yztVfJ8oaA66f8oQ,21
|
8
8
|
qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
qulab/cli/commands.py,sha256=tgDIkkeIoasQXAifJZ6NU8jDgpNgb2a-B0C4nF0evrE,559
|
10
10
|
qulab/cli/config.py,sha256=SdNmWzweWAdyk8M2oKYhMxnkaJ0qIayPlsLGCNlVqME,3108
|
11
11
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
12
|
-
qulab/executor/cli.py,sha256=
|
13
|
-
qulab/executor/load.py,sha256=
|
14
|
-
qulab/executor/schedule.py,sha256=
|
15
|
-
qulab/executor/storage.py,sha256
|
12
|
+
qulab/executor/cli.py,sha256=n0wl27xaiMWg18rVDOaKgLTEXaN0tSv4whTUQxvzBoM,8932
|
13
|
+
qulab/executor/load.py,sha256=RJpgDuxNc3sUzr65K6a4vO-Qa72_lYsJGrPZDfw9Rus,18077
|
14
|
+
qulab/executor/schedule.py,sha256=jBUK0vXeu-gbieSaH245exlGu3TW6vg9o0GIEF43IvA,16796
|
15
|
+
qulab/executor/storage.py,sha256=k8rcyUHaAixMtWRTNfQrjFhingYqBb0fJZwHBLVE_UM,11002
|
16
16
|
qulab/executor/transform.py,sha256=kaDJePBhVc32gZkQN8YBuA69lYYW9YhDZmCnUKaWuQw,2189
|
17
17
|
qulab/executor/utils.py,sha256=XDk3duNrqDsCqZyZUmPqIAIIiykiafcOMBpy9NVAOAw,5686
|
18
18
|
qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
|
@@ -94,9 +94,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
|
|
94
94
|
qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
|
95
95
|
qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
|
96
96
|
qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
|
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.6.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
|
98
|
+
QuLab-2.7.6.dist-info/METADATA,sha256=CUCFSSV87lDFOp15xOhzDpvmL3P7TMje6GOlrckku_E,3698
|
99
|
+
QuLab-2.7.6.dist-info/WHEEL,sha256=iDXcyuxg-66TzzqHGH-kgw_HJdaJE_1RHznrvPNCSNs,115
|
100
|
+
QuLab-2.7.6.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
101
|
+
QuLab-2.7.6.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
102
|
+
QuLab-2.7.6.dist-info/RECORD,,
|
qulab/executor/cli.py
CHANGED
qulab/executor/load.py
CHANGED
qulab/executor/schedule.py
CHANGED
@@ -11,6 +11,38 @@ from .storage import (Result, find_result, get_heads, renew_result,
|
|
11
11
|
revoke_result, save_result)
|
12
12
|
from .transform import current_config, obey_the_oracle, update_parameters
|
13
13
|
|
14
|
+
__session_id = None
|
15
|
+
__session_cache = {}
|
16
|
+
|
17
|
+
|
18
|
+
def set_cache(session_id, key, result: Result):
|
19
|
+
global __session_id
|
20
|
+
if __session_id is None:
|
21
|
+
__session_id = session_id
|
22
|
+
if __session_id != session_id:
|
23
|
+
__session_cache.clear()
|
24
|
+
if result.workflow.startswith('cfg:'):
|
25
|
+
__session_cache[key] = result
|
26
|
+
else:
|
27
|
+
__session_cache[key] = result.base_path, result.path
|
28
|
+
|
29
|
+
|
30
|
+
def get_cache(session_id, key) -> Result:
|
31
|
+
from .storage import load_result
|
32
|
+
global __session_id
|
33
|
+
if __session_id is None or __session_id != session_id:
|
34
|
+
return None
|
35
|
+
index = __session_cache.get(key, None)
|
36
|
+
if index is None:
|
37
|
+
return None
|
38
|
+
if isinstance(index, tuple):
|
39
|
+
base_path, path = index
|
40
|
+
return load_result(base_path, path)
|
41
|
+
elif isinstance(index, Result):
|
42
|
+
return index
|
43
|
+
else:
|
44
|
+
return None
|
45
|
+
|
14
46
|
|
15
47
|
class CalibrationFailedError(Exception):
|
16
48
|
pass
|
@@ -130,7 +162,6 @@ def call_plot(node, result: Result, check=False):
|
|
130
162
|
node.plot(result)
|
131
163
|
|
132
164
|
|
133
|
-
@functools.lru_cache(maxsize=128)
|
134
165
|
def check_data(workflow: WorkflowType, code_path: str | Path,
|
135
166
|
state_path: str | Path, plot: bool, session_id: str) -> Result:
|
136
167
|
"""
|
@@ -138,13 +169,19 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
138
169
|
Is the parameter associated with this cal in spec,
|
139
170
|
and is the cal scan working as expected?
|
140
171
|
"""
|
172
|
+
result = get_cache(session_id, (workflow, 'check_data'))
|
173
|
+
if result is not None:
|
174
|
+
logger.debug(f'Cache hit for "{workflow.__workflow_id__}:check_data"')
|
175
|
+
return result
|
176
|
+
|
141
177
|
history = find_result(workflow.__workflow_id__, state_path)
|
142
178
|
|
143
179
|
if history is None:
|
144
180
|
logger.debug(f'No history found for "{workflow.__workflow_id__}"')
|
145
181
|
result = Result(workflow=workflow.__workflow_id__,
|
146
182
|
config_path=current_config(state_path),
|
147
|
-
base_path=state_path
|
183
|
+
base_path=state_path,
|
184
|
+
heads=get_heads(state_path))
|
148
185
|
result.in_spec = False
|
149
186
|
result.bad_data = False
|
150
187
|
return result
|
@@ -173,7 +210,8 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
173
210
|
result = Result(workflow=workflow.__workflow_id__,
|
174
211
|
data=data,
|
175
212
|
config_path=current_config(state_path),
|
176
|
-
base_path=state_path
|
213
|
+
base_path=state_path,
|
214
|
+
heads=get_heads(state_path))
|
177
215
|
#save_result(workflow.__workflow_id__, result, state_path)
|
178
216
|
|
179
217
|
logger.debug(f'Checked "{workflow.__workflow_id__}" !')
|
@@ -204,7 +242,8 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
204
242
|
result = Result(workflow=workflow.__workflow_id__,
|
205
243
|
data=data,
|
206
244
|
config_path=current_config(state_path),
|
207
|
-
base_path=state_path
|
245
|
+
base_path=state_path,
|
246
|
+
heads=get_heads(state_path))
|
208
247
|
save_result(workflow.__workflow_id__, result, state_path)
|
209
248
|
|
210
249
|
logger.debug(f'Calibrated "{workflow.__workflow_id__}" !')
|
@@ -218,12 +257,17 @@ def check_data(workflow: WorkflowType, code_path: str | Path,
|
|
218
257
|
state_path,
|
219
258
|
overwrite=True)
|
220
259
|
|
260
|
+
set_cache(session_id, (workflow, 'check_data'), result)
|
221
261
|
return result
|
222
262
|
|
223
263
|
|
224
|
-
@functools.lru_cache(maxsize=128)
|
225
264
|
def calibrate(workflow: WorkflowType, code_path: str | Path,
|
226
265
|
state_path: str | Path, plot: bool, session_id: str) -> Result:
|
266
|
+
result = get_cache(session_id, (workflow, 'calibrate'))
|
267
|
+
if result is not None:
|
268
|
+
logger.debug(f'Cache hit for "{workflow.__workflow_id__}:calibrate"')
|
269
|
+
return result
|
270
|
+
|
227
271
|
history = find_result(workflow.__workflow_id__, state_path)
|
228
272
|
|
229
273
|
logger.debug(f'Calibrating "{workflow.__workflow_id__}" ...')
|
@@ -235,11 +279,14 @@ def calibrate(workflow: WorkflowType, code_path: str | Path,
|
|
235
279
|
result = Result(workflow=workflow.__workflow_id__,
|
236
280
|
data=data,
|
237
281
|
config_path=current_config(state_path),
|
238
|
-
base_path=state_path
|
282
|
+
base_path=state_path,
|
283
|
+
heads=get_heads(state_path))
|
239
284
|
save_result(workflow.__workflow_id__, result, state_path)
|
240
285
|
logger.debug(f'Calibrated "{workflow.__workflow_id__}" !')
|
241
286
|
result = call_analyzer(workflow, result, history, check=False, plot=plot)
|
242
287
|
save_result(workflow.__workflow_id__, result, state_path, overwrite=True)
|
288
|
+
|
289
|
+
set_cache(session_id, (workflow, 'calibrate'), result)
|
243
290
|
return result
|
244
291
|
|
245
292
|
|
qulab/executor/storage.py
CHANGED
@@ -27,11 +27,13 @@ class Result():
|
|
27
27
|
parameters: dict = field(default_factory=dict)
|
28
28
|
oracle: dict = field(default_factory=dict)
|
29
29
|
other_infomation: dict = field(default_factory=dict)
|
30
|
-
data: Any = field(default_factory=tuple)
|
30
|
+
data: Any = field(default_factory=tuple, repr=False)
|
31
31
|
index: int = -1
|
32
|
-
previous_path: Path | None = None
|
33
|
-
|
34
|
-
|
32
|
+
previous_path: Path | None = field(default=None, repr=False)
|
33
|
+
heads: dict[str, Path] = field(default_factory=dict, repr=False)
|
34
|
+
base_path: Path | None = field(default=None, repr=False)
|
35
|
+
path: Path | None = field(default=None, repr=False)
|
36
|
+
config_path: Path | None = field(default=None, repr=False)
|
35
37
|
|
36
38
|
@property
|
37
39
|
def previous(self):
|
@@ -100,7 +102,8 @@ def save_config_key_history(key: str, result: Result,
|
|
100
102
|
else:
|
101
103
|
__current_config_cache = {}
|
102
104
|
|
103
|
-
__current_config_cache[
|
105
|
+
__current_config_cache[
|
106
|
+
key] = result.data, result.calibrated_time, result.checked_time
|
104
107
|
|
105
108
|
with open(base_path / 'parameters.pkl', 'wb') as f:
|
106
109
|
pickle.dump(__current_config_cache, f)
|
@@ -118,14 +121,18 @@ def find_config_key_history(key: str, base_path: str | Path) -> Result | None:
|
|
118
121
|
__current_config_cache = {}
|
119
122
|
|
120
123
|
if key in __current_config_cache:
|
121
|
-
value = __current_config_cache.get(
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
value, calibrated_time, checked_time = __current_config_cache.get(
|
125
|
+
key, None)
|
126
|
+
result = Result(
|
127
|
+
workflow=f'cfg:{key}',
|
128
|
+
bad_data=False,
|
129
|
+
in_spec=True,
|
130
|
+
fully_calibrated=True,
|
131
|
+
parameters={key: value},
|
132
|
+
data=value,
|
133
|
+
calibrated_time=calibrated_time,
|
134
|
+
checked_time=checked_time,
|
135
|
+
)
|
129
136
|
return result
|
130
137
|
return None
|
131
138
|
|
@@ -143,7 +150,10 @@ def save_result(workflow: str,
|
|
143
150
|
base_path = Path(base_path)
|
144
151
|
if overwrite:
|
145
152
|
buf = lzma.compress(pickle.dumps(result))
|
146
|
-
path =
|
153
|
+
path = result.path
|
154
|
+
if path is None:
|
155
|
+
path = get_head(workflow, base_path)
|
156
|
+
result.path = path
|
147
157
|
with open(base_path / 'objects' / path, "rb") as f:
|
148
158
|
index = int.from_bytes(f.read(8), 'big')
|
149
159
|
result.index = index
|
@@ -153,6 +163,7 @@ def save_result(workflow: str,
|
|
153
163
|
path = random_path(base_path / 'objects')
|
154
164
|
(base_path / 'objects' / path).parent.mkdir(parents=True,
|
155
165
|
exist_ok=True)
|
166
|
+
result.path = path
|
156
167
|
result.index = create_index("result",
|
157
168
|
base_path,
|
158
169
|
context=str(path),
|
qulab/fun.cpython-312-darwin.so
CHANGED
Binary file
|
qulab/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.7.
|
1
|
+
__version__ = "2.7.6"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|