QuLab 2.2.0__cp312-cp312-win_amd64.whl → 2.2.4__cp312-cp312-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.2.0.dist-info → QuLab-2.2.4.dist-info}/METADATA +1 -1
- {QuLab-2.2.0.dist-info → QuLab-2.2.4.dist-info}/RECORD +12 -12
- qulab/fun.cp312-win_amd64.pyd +0 -0
- qulab/scan/query.py +3 -1
- qulab/scan/record.py +25 -0
- qulab/scan/scan.py +28 -30
- qulab/scan/server.py +22 -8
- qulab/version.py +1 -1
- {QuLab-2.2.0.dist-info → QuLab-2.2.4.dist-info}/LICENSE +0 -0
- {QuLab-2.2.0.dist-info → QuLab-2.2.4.dist-info}/WHEEL +0 -0
- {QuLab-2.2.0.dist-info → QuLab-2.2.4.dist-info}/entry_points.txt +0 -0
- {QuLab-2.2.0.dist-info → QuLab-2.2.4.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
qulab/__init__.py,sha256=vkFybY8YSsQilYdThPRD83-btPAR41sy_WCXiM-6mME,141
|
|
2
2
|
qulab/__main__.py,sha256=V7iokU7awstgjCeiF_hoOdFyrqJwC_4QetiLe7cWvOQ,454
|
|
3
|
-
qulab/fun.cp312-win_amd64.pyd,sha256=
|
|
4
|
-
qulab/version.py,sha256=
|
|
3
|
+
qulab/fun.cp312-win_amd64.pyd,sha256=IBy9wknYRFmBy6ejRzfWSHqSsJzzbP0_emTuzdQW4rU,32256
|
|
4
|
+
qulab/version.py,sha256=q2oNXq5isDMLWwNWH0ZSaEk8JVgaJMDOwWNURaUZwW0,21
|
|
5
5
|
qulab/monitor/__init__.py,sha256=xEVDkJF8issrsDeLqQmDsvtRmrf-UiViFcGTWuzdlFU,43
|
|
6
6
|
qulab/monitor/__main__.py,sha256=k2H1H5Zf9LLXTDLISJkbikLH-z0f1e5i5i6wXXYPOrE,105
|
|
7
7
|
qulab/monitor/config.py,sha256=y_5StMkdrbZO1ziyKBrvIkB7Jclp9RCPK1QbsOhCxnY,785
|
|
@@ -17,10 +17,10 @@ qulab/scan/curd.py,sha256=yaTglGiS6mlk0GqDHi_w8T02XGBMvDZtXSdML7zDywk,7117
|
|
|
17
17
|
qulab/scan/expression.py,sha256=vwUM9E0OFQal4bljlUtLR3NJu4zGRyuWYrdyZSs3QTU,16199
|
|
18
18
|
qulab/scan/models.py,sha256=ZvXkJEt5Yz3Sjx0JKzYka-q2Uo-w_iVzHgH8A6DbjF0,18236
|
|
19
19
|
qulab/scan/optimize.py,sha256=MlT4y422CnP961IR384UKryyZh8riNvrPSd2z_MXLEg,2356
|
|
20
|
-
qulab/scan/query.py,sha256=
|
|
21
|
-
qulab/scan/record.py,sha256=
|
|
22
|
-
qulab/scan/scan.py,sha256=
|
|
23
|
-
qulab/scan/server.py,sha256=
|
|
20
|
+
qulab/scan/query.py,sha256=z94Ofbii4HZ4ZyZ7nos9-y37bH8-Xg4mA3QsF_aWx-c,11907
|
|
21
|
+
qulab/scan/record.py,sha256=iCGkzIAFPYnT6idc--VloEVtyJPnHr35xt09lqtX674,20150
|
|
22
|
+
qulab/scan/scan.py,sha256=fNpcL5KKSAGA1y6qteSxmH0Ii_I3IdDv5-ihhx1HUAs,35457
|
|
23
|
+
qulab/scan/server.py,sha256=h5CPS1zKtBs0cKvEBdmT8_EQ_cxyX8VXGEjPlk9iD2I,12549
|
|
24
24
|
qulab/scan/space.py,sha256=PBa7Z6KnS690x79WS2YU3PTA_s5K6MCJ6JmS93vs2s4,5381
|
|
25
25
|
qulab/scan/utils.py,sha256=30qnYvyFyctwcWxOCUpCNxXgGysA7xdIDzYbjwxGUzA,3744
|
|
26
26
|
qulab/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -78,9 +78,9 @@ qulab/visualization/plot_layout.py,sha256=yAnMONOms7_szCdng-8wPpUMPis5UnbaNNzV4K
|
|
|
78
78
|
qulab/visualization/plot_seq.py,sha256=h9D0Yl_yO64IwlvBgzMu9EBKr9gg6y8QE55gu2PfTns,2783
|
|
79
79
|
qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
|
|
80
80
|
qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
|
|
81
|
-
QuLab-2.2.
|
|
82
|
-
QuLab-2.2.
|
|
83
|
-
QuLab-2.2.
|
|
84
|
-
QuLab-2.2.
|
|
85
|
-
QuLab-2.2.
|
|
86
|
-
QuLab-2.2.
|
|
81
|
+
QuLab-2.2.4.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
|
|
82
|
+
QuLab-2.2.4.dist-info/METADATA,sha256=rpYdVqhhvhXOKTwDw0eKf_z6Se2qN_nXcV4H9hi13NA,3609
|
|
83
|
+
QuLab-2.2.4.dist-info/WHEEL,sha256=fZWyj_84lK0cA-ZNCsdwhbJl0OTrpWkxInEn424qrSs,102
|
|
84
|
+
QuLab-2.2.4.dist-info/entry_points.txt,sha256=ohBzutEnQimP_BZWiuXdSliu4QAYSHHcN0PZD8c7ZCY,46
|
|
85
|
+
QuLab-2.2.4.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
|
86
|
+
QuLab-2.2.4.dist-info/RECORD,,
|
qulab/fun.cp312-win_amd64.pyd
CHANGED
|
Binary file
|
qulab/scan/query.py
CHANGED
|
@@ -12,8 +12,8 @@ from sqlalchemy.orm import sessionmaker
|
|
|
12
12
|
from qulab.sys.rpc.zmq_socket import ZMQContextManager
|
|
13
13
|
|
|
14
14
|
from .record import Record
|
|
15
|
-
from .server import get_local_record
|
|
16
15
|
from .scan import default_server
|
|
16
|
+
from .server import get_local_record
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_record(id, database=default_server) -> Record:
|
|
@@ -24,6 +24,8 @@ def get_record(id, database=default_server) -> Record:
|
|
|
24
24
|
'record_id': id
|
|
25
25
|
})
|
|
26
26
|
d = dill.loads(socket.recv_pyobj())
|
|
27
|
+
if d is None:
|
|
28
|
+
raise ValueError(f'No record with id {id}')
|
|
27
29
|
d.id = id
|
|
28
30
|
d.database = database
|
|
29
31
|
d._file = None
|
qulab/scan/record.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import itertools
|
|
2
|
+
import lzma
|
|
3
|
+
import pickle
|
|
2
4
|
import sys
|
|
3
5
|
import uuid
|
|
4
6
|
import zipfile
|
|
@@ -12,6 +14,7 @@ import zmq
|
|
|
12
14
|
|
|
13
15
|
from qulab.sys.rpc.zmq_socket import ZMQContextManager
|
|
14
16
|
|
|
17
|
+
from .curd import get_config
|
|
15
18
|
from .space import OptimizeSpace, Space
|
|
16
19
|
|
|
17
20
|
_not_given = object()
|
|
@@ -326,6 +329,28 @@ class Record():
|
|
|
326
329
|
def axis(self):
|
|
327
330
|
return self.description.get('axis', {})
|
|
328
331
|
|
|
332
|
+
def config(self, cls=dict, session=None, datapath=None):
|
|
333
|
+
config_id = self.description.get('config', None)
|
|
334
|
+
if config_id is None:
|
|
335
|
+
return None
|
|
336
|
+
if isinstance(config_id, dict):
|
|
337
|
+
return cls(config_id)
|
|
338
|
+
if self.is_remote_record():
|
|
339
|
+
with ZMQContextManager(zmq.DEALER,
|
|
340
|
+
connect=self.database) as socket:
|
|
341
|
+
socket.send_pyobj({
|
|
342
|
+
'method': 'config_get',
|
|
343
|
+
'config_id': config_id
|
|
344
|
+
})
|
|
345
|
+
buf = socket.recv_pyobj()
|
|
346
|
+
return cls(pickle.loads(lzma.decompress(buf)))
|
|
347
|
+
else:
|
|
348
|
+
assert session is not None, "session is required for local record"
|
|
349
|
+
assert datapath is not None, "datapath is required for local record"
|
|
350
|
+
config = get_config(session, config_id, base=datapath / 'objects')
|
|
351
|
+
session.commit()
|
|
352
|
+
return cls(config)
|
|
353
|
+
|
|
329
354
|
def is_local_record(self):
|
|
330
355
|
return not self.is_cache_record() and not self.is_remote_record()
|
|
331
356
|
|
qulab/scan/scan.py
CHANGED
|
@@ -145,17 +145,6 @@ async def create_config(config: dict, database=default_server, socket=None):
|
|
|
145
145
|
return await socket.recv_pyobj()
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
async def get_config(config_id: int, database=default_server, socket=None):
|
|
149
|
-
async with ZMQContextManager(zmq.DEALER, connect=database,
|
|
150
|
-
socket=socket) as socket:
|
|
151
|
-
await socket.send_pyobj({
|
|
152
|
-
'method': 'config_get',
|
|
153
|
-
'config_id': config_id
|
|
154
|
-
})
|
|
155
|
-
buf = await socket.recv_pyobj()
|
|
156
|
-
return pickle.loads(lzma.decompress(buf))
|
|
157
|
-
|
|
158
|
-
|
|
159
148
|
def task_uuid():
|
|
160
149
|
return uuid.uuid3(__process_uuid, str(next(__task_counter)))
|
|
161
150
|
|
|
@@ -332,16 +321,8 @@ class Scan():
|
|
|
332
321
|
async def _emit(self, current_level, step, position, variables: dict[str,
|
|
333
322
|
Any]):
|
|
334
323
|
for key, value in list(variables.items()):
|
|
335
|
-
if key.startswith('
|
|
336
|
-
|
|
337
|
-
variables.update(value)
|
|
338
|
-
del variables[key]
|
|
339
|
-
elif inspect.isawaitable(value):
|
|
340
|
-
d = await value
|
|
341
|
-
assert isinstance(
|
|
342
|
-
d, dict), f"Should promise a dict for `**` symbol."
|
|
343
|
-
variables.update(d)
|
|
344
|
-
del variables[key]
|
|
324
|
+
if key.startswith('*'):
|
|
325
|
+
await _unpack(key, variables)
|
|
345
326
|
elif inspect.isawaitable(value) and not self.hiden(key):
|
|
346
327
|
variables[key] = await value
|
|
347
328
|
if self._sock is not None:
|
|
@@ -373,7 +354,7 @@ class Scan():
|
|
|
373
354
|
|
|
374
355
|
def hiden(self, name: str) -> bool:
|
|
375
356
|
return bool(
|
|
376
|
-
self._hide_pattern_re.match(name)) and not name.startswith('
|
|
357
|
+
self._hide_pattern_re.match(name)) and not name.startswith('*')
|
|
377
358
|
|
|
378
359
|
async def _filter(self, variables: dict[str, Any], level: int = 0):
|
|
379
360
|
try:
|
|
@@ -984,14 +965,8 @@ async def _iter_level(variables,
|
|
|
984
965
|
|
|
985
966
|
if opts:
|
|
986
967
|
for key in list(variables.keys()):
|
|
987
|
-
if key.startswith('
|
|
988
|
-
|
|
989
|
-
if inspect.isawaitable(d):
|
|
990
|
-
d = await d
|
|
991
|
-
assert isinstance(
|
|
992
|
-
d, dict), f"Should promise a dict for `**` symbol."
|
|
993
|
-
variables.update(d)
|
|
994
|
-
del variables[key]
|
|
968
|
+
if key.startswith('*'):
|
|
969
|
+
await _unpack(key, variables)
|
|
995
970
|
|
|
996
971
|
for name, opt in opts.items():
|
|
997
972
|
opt_cfg = optimizers[name]
|
|
@@ -1035,3 +1010,26 @@ async def call_many_functions(order: list[list[str]],
|
|
|
1035
1010
|
results = await asyncio.gather(*coros)
|
|
1036
1011
|
ret.update(dict(zip(waited, results)))
|
|
1037
1012
|
return ret
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
async def _unpack(key, variables):
|
|
1016
|
+
x = variables[key]
|
|
1017
|
+
if inspect.isawaitable(x):
|
|
1018
|
+
x = await x
|
|
1019
|
+
if key.startswith('**'):
|
|
1020
|
+
assert isinstance(x, dict), f"Should promise a dict for `**` symbol."
|
|
1021
|
+
if "{key}" in key:
|
|
1022
|
+
for k, v in x.items():
|
|
1023
|
+
variables[key[2:].format(key=k)] = v
|
|
1024
|
+
else:
|
|
1025
|
+
variables.update(x)
|
|
1026
|
+
elif key.startswith('*'):
|
|
1027
|
+
assert isinstance(
|
|
1028
|
+
x, (list, tuple,
|
|
1029
|
+
np.ndarray)), f"Should promise a list for `*` symbol."
|
|
1030
|
+
for i, v in enumerate(x):
|
|
1031
|
+
k = key[1:].format(i=i)
|
|
1032
|
+
variables[k] = v
|
|
1033
|
+
else:
|
|
1034
|
+
return
|
|
1035
|
+
del variables[key]
|
qulab/scan/server.py
CHANGED
|
@@ -65,6 +65,8 @@ def flush_cache():
|
|
|
65
65
|
|
|
66
66
|
def get_local_record(session: Session, id: int, datapath: Path) -> Record:
|
|
67
67
|
record_in_db = session.get(RecordInDB, id)
|
|
68
|
+
if record_in_db is None:
|
|
69
|
+
return None
|
|
68
70
|
record_in_db.atime = utcnow()
|
|
69
71
|
|
|
70
72
|
if record_in_db.file.endswith('.zip'):
|
|
@@ -220,21 +222,33 @@ async def handle(session: Session, request: Request, datapath: Path):
|
|
|
220
222
|
await reply(request, config.id)
|
|
221
223
|
case 'submit':
|
|
222
224
|
from .scan import Scan
|
|
225
|
+
finished = [(id, queried) for id, (task, queried) in pool.items()
|
|
226
|
+
if not isinstance(task, int) and task.finished()]
|
|
227
|
+
for id, queried in finished:
|
|
228
|
+
if not queried:
|
|
229
|
+
pool[id] = [pool[id].record.id, False]
|
|
230
|
+
else:
|
|
231
|
+
pool.pop(id)
|
|
223
232
|
description = dill.loads(msg['description'])
|
|
224
233
|
task = Scan()
|
|
225
234
|
task.description = description
|
|
226
235
|
task.start()
|
|
227
|
-
pool[task.id] = task
|
|
236
|
+
pool[task.id] = [task, False]
|
|
228
237
|
await reply(request, task.id)
|
|
229
238
|
case 'get_record_id':
|
|
230
|
-
task = pool.get(msg['id'])
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
break
|
|
235
|
-
await asyncio.sleep(1)
|
|
239
|
+
task, queried = pool.get(msg['id'])
|
|
240
|
+
if isinstance(task, int):
|
|
241
|
+
await reply(request, task)
|
|
242
|
+
pool.pop(msg['id'])
|
|
236
243
|
else:
|
|
237
|
-
|
|
244
|
+
for _ in range(10):
|
|
245
|
+
if task.record:
|
|
246
|
+
await reply(request, task.record.id)
|
|
247
|
+
pool[msg['id']] = [task, True]
|
|
248
|
+
break
|
|
249
|
+
await asyncio.sleep(1)
|
|
250
|
+
else:
|
|
251
|
+
await reply(request, None)
|
|
238
252
|
case _:
|
|
239
253
|
logger.error(f"Unknown method: {msg['method']}")
|
|
240
254
|
|
qulab/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.2.
|
|
1
|
+
__version__ = "2.2.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|