QuLab 2.7.11__cp310-cp310-win_amd64.whl → 2.7.13__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/cli/config.py CHANGED
@@ -68,6 +68,10 @@ def log_options(func):
68
68
  type=click.Path(),
69
69
  default=lambda: get_config_value("log", Path),
70
70
  help=f"Log file path")
71
+ @click.option("--debug-log",
72
+ type=click.Path(),
73
+ default=lambda: get_config_value("debug_log", Path),
74
+ help=f"Debug log file path")
71
75
  @click.option("--quiet",
72
76
  is_flag=True,
73
77
  default=get_config_value("quiet", bool),
@@ -76,6 +80,7 @@ def log_options(func):
76
80
  def wrapper(*args, **kwargs):
77
81
  debug = bool(kwargs.pop("debug"))
78
82
  log = kwargs.pop("log")
83
+ debug_log = kwargs.pop("debug_log")
79
84
  quiet = bool(kwargs.pop("quiet"))
80
85
 
81
86
  if debug:
@@ -85,7 +90,17 @@ def log_options(func):
85
90
 
86
91
  handlers = []
87
92
  if log is not None:
88
- handlers.append(dict(sink=log, level=log_level))
93
+ handlers.append(
94
+ dict(sink=log,
95
+ level="INFO",
96
+ rotation="monday at 7:00",
97
+ compression="zip"))
98
+ if debug_log is not None:
99
+ handlers.append(
100
+ dict(sink=debug_log,
101
+ level="DEBUG",
102
+ rotation="monday at 7:00",
103
+ compression="zip"))
89
104
  if not quiet or debug:
90
105
  handlers.append(dict(sink=sys.stderr, level=log_level))
91
106
 
@@ -1,4 +1,5 @@
1
1
  import functools
2
+ import inspect
2
3
  import pickle
3
4
  import uuid
4
5
  from datetime import datetime, timedelta
@@ -231,21 +232,7 @@ def call_analyzer(node: WorkflowType,
231
232
  if hasattr(node, 'oracle') and callable(node.oracle):
232
233
  logger.debug(
233
234
  f'"{node.__workflow_id__}" has oracle method, calling ...')
234
- try:
235
- report = node.oracle(report,
236
- history=history,
237
- system_state=get_heads(report.base_path))
238
- except Exception as e:
239
- logger.exception(e)
240
- report.oracle = {}
241
- if not isinstance(report, Report):
242
- raise TypeError(
243
- f'"{node.__workflow_id__}" : function "oracle" must return a Report object'
244
- )
245
- if not is_pickleable(report.oracle):
246
- raise TypeError(
247
- f'"{node.__workflow_id__}" : function "oracle" return not pickleable data'
248
- )
235
+ report = call_oracle(node, report, history)
249
236
  report.fully_calibrated = True
250
237
  save_report(node.__workflow_id__, report, state_path, overwrite=True)
251
238
  if plot:
@@ -253,6 +240,35 @@ def call_analyzer(node: WorkflowType,
253
240
  return report
254
241
 
255
242
 
243
+ def call_oracle(node: WorkflowType, report: Report, history: Report | None):
244
+ sig = inspect.signature(node.oracle)
245
+ try:
246
+ if 'history' in sig.parameters and 'system_state' in sig.parameters:
247
+ report = node.oracle(report,
248
+ history=history,
249
+ system_state=get_heads(report.base_path))
250
+ elif 'history' in sig.parameters:
251
+ report = node.oracle(report, history=history)
252
+ elif 'system_state' in sig.parameters:
253
+ report = node.oracle(report,
254
+ system_state=get_heads(report.base_path))
255
+ else:
256
+ report = node.oracle(report)
257
+ except Exception as e:
258
+ logger.exception(e)
259
+ report.oracle = {}
260
+ return report
261
+ if not isinstance(report, Report):
262
+ raise TypeError(
263
+ f'"{node.__workflow_id__}" : function "oracle" must return a Report object'
264
+ )
265
+ if not is_pickleable(report.oracle):
266
+ raise TypeError(
267
+ f'"{node.__workflow_id__}" : function "oracle" return not pickleable data'
268
+ )
269
+ return report
270
+
271
+
256
272
  def check_data(workflow: WorkflowType, state_path: str | Path, plot: bool,
257
273
  session_id: str) -> Report:
258
274
  """
@@ -387,6 +403,7 @@ def diagnose(workflow: WorkflowType, code_path: str | Path,
387
403
  f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
388
404
  )
389
405
  update_parameters(report, state_path)
406
+ logger.debug(f'"{workflow.__workflow_id__}": parameters updated')
390
407
  return True
391
408
 
392
409
 
@@ -451,6 +468,9 @@ def maintain(workflow: WorkflowType,
451
468
  )
452
469
  if not freeze:
453
470
  update_parameters(report, state_path)
471
+ logger.debug(f'"{workflow.__workflow_id__}": parameters updated')
472
+ else:
473
+ logger.debug(f'"{workflow.__workflow_id__}": parameters freezed')
454
474
  return
455
475
 
456
476
 
@@ -471,4 +491,7 @@ def run(workflow: WorkflowType,
471
491
  )
472
492
  if not freeze:
473
493
  update_parameters(report, state_path)
494
+ logger.debug(f'"{workflow.__workflow_id__}": parameters updated')
495
+ else:
496
+ logger.debug(f'"{workflow.__workflow_id__}": parameters freezed')
474
497
  return
Binary file
@@ -0,0 +1,39 @@
1
+ class _Missing():
2
+
3
+ def __repr__(self):
4
+ return "Missing"
5
+
6
+
7
+ Missing = _Missing()
8
+
9
+
10
+ def connect_trace(*mappings):
11
+ if not mappings:
12
+ return {}
13
+ result = {}
14
+ first_mapping = mappings[0]
15
+ for key in first_mapping:
16
+ current_value = key
17
+ trajectory = []
18
+ for mapping in mappings:
19
+ if current_value is Missing:
20
+ trajectory.append(Missing)
21
+ continue
22
+ if current_value in mapping:
23
+ next_value = mapping[current_value]
24
+ trajectory.append(next_value)
25
+ current_value = next_value
26
+ else:
27
+ trajectory.append(Missing)
28
+ current_value = Missing
29
+ result[key] = trajectory
30
+ return result
31
+
32
+
33
+ def connect(*mappings):
34
+ if not mappings:
35
+ return {}
36
+ return {
37
+ k: v[-1]
38
+ for k, v in connect_trace(*mappings).items() if v[-1] is not Missing
39
+ }
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.7.11"
1
+ __version__ = "2.7.13"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.7.11
3
+ Version: 2.7.13
4
4
  Summary: contral instruments and manage data
5
5
  Author-email: feihoo87 <feihoo87@gmail.com>
6
6
  Maintainer-email: feihoo87 <feihoo87@gmail.com>
@@ -1,17 +1,17 @@
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.cp310-win_amd64.pyd,sha256=m-A6E32c1JhJC_HVQJ5f2_md1qjsQ_m1EMKXBKwDpiE,31232
4
+ qulab/fun.cp310-win_amd64.pyd,sha256=sDBegOGBRlir37M8Be7ZXKj6TNIDlocMKBVjlZNXHK0,31232
5
5
  qulab/typing.py,sha256=PRtwbCHWY2ROKK8GHq4Bo8llXrIGo6xC73DrQf7S9os,71
6
6
  qulab/utils.py,sha256=UyZNPIyvis5t2MJBkXXLO5EmYP3mQZbt87zmYAHgoyk,1291
7
- qulab/version.py,sha256=1KL8md1HXIKNwnebAea7SJ7-uBme-7LHKGfuCG29ZiU,22
7
+ qulab/version.py,sha256=aT1ObWeGn4CAPTB2n1JwBZCtp9XDVJssGu0Z4ACIIQ4,22
8
8
  qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  qulab/cli/commands.py,sha256=6xd2eYw32k1NmfAuYSu__1kaP12Oz1QVqwbkYXdWno4,588
10
- qulab/cli/config.py,sha256=tNmH4ggdgrFqcQa2WZKLpidiYTg95_UnT0paDJ4fi4c,3204
10
+ qulab/cli/config.py,sha256=7h3k0K8FYHhI6LVWt8BoDdKrX2ApFDBAUAUuXhHwst4,3799
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=137OlWojJICEsq2BSz1ybOa1Gy8-f8U4KSC6YLgdjZ4,18061
14
+ qulab/executor/schedule.py,sha256=9pTOVWzKiDc7ip8iuB_47poJcYOvoBI9eQwTrDTA3p0,19044
15
15
  qulab/executor/storage.py,sha256=gI6g28BmKKEZ_Pl-hFwvpiOj3mF8Su-yjj3hfMXs1VY,11630
16
16
  qulab/executor/transform.py,sha256=4DyGXv1Iw36cCPqbqXlsn0Lw6gFjQpp_6Hcta50YQxU,2181
17
17
  qulab/executor/utils.py,sha256=cF6-2jlvlHyTjNHdxXKG04Fjfm3_3wfDQAF1G8DQphk,5686
@@ -85,6 +85,7 @@ qulab/sys/rpc/socket.py,sha256=W3bPwe8um1IeR_3HLx-ad6iCcbeuUQcSg11Ze4w6DJg,742
85
85
  qulab/sys/rpc/utils.py,sha256=BurIcqh8CS-Hsk1dYP6IiefK4qHivaEqD9_rBY083SA,619
86
86
  qulab/sys/rpc/worker.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  qulab/sys/rpc/zmq_socket.py,sha256=aoIm-C-IdJjm9_PQXckvbqTxc9kCeJrT4PyYytoDIHo,8492
88
+ qulab/tools/__init__.py,sha256=-qZJcLsfueyHMihcbMp3HU3VRwz8zB0wnlosSjKp6R0,985
88
89
  qulab/visualization/__init__.py,sha256=Bkt9AK5c45d6HFLlT-f8cIppywXziHtJqhDtVxOoKKo,6317
89
90
  qulab/visualization/__main__.py,sha256=WduINFl21B-XMsi2rg2cVhIyU11hKKX3zOsjc56QLiQ,1710
90
91
  qulab/visualization/_autoplot.py,sha256=gK3m5STiUigcQdJ3NzqD5jEITkPAsTsWMnmw6nUJfvE,14629
@@ -94,9 +95,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
94
95
  qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
95
96
  qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
96
97
  qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
97
- QuLab-2.7.11.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
98
- QuLab-2.7.11.dist-info/METADATA,sha256=ZWK3GzveHjjVhPbhGV2e3XIGxCSbmsU3KgUlb4-nwEo,3804
99
- QuLab-2.7.11.dist-info/WHEEL,sha256=rzGfZgUcGeKSgIHGYMuqg4xE4VPHxnaldXH6BG0zjVk,101
100
- QuLab-2.7.11.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
101
- QuLab-2.7.11.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
102
- QuLab-2.7.11.dist-info/RECORD,,
98
+ qulab-2.7.13.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
99
+ qulab-2.7.13.dist-info/METADATA,sha256=xjqn4NNAHSvgY79ASBUx7tCaHHqJ_vQVkAH62v4sEJY,3804
100
+ qulab-2.7.13.dist-info/WHEEL,sha256=gMSPBFjPynvgFG2ofmeEoM1Uf9iH_GsJd2JBy-bxpiQ,101
101
+ qulab-2.7.13.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
102
+ qulab-2.7.13.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
103
+ qulab-2.7.13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-cp310-win_amd64
5
5