QuLab 2.12.0__tar.gz → 2.12.1__tar.gz
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.12.0 → qulab-2.12.1}/PKG-INFO +1 -1
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/PKG-INFO +1 -1
- {qulab-2.12.0 → qulab-2.12.1}/qulab/cli/commands.py +3 -2
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/cli.py +19 -2
- {qulab-2.12.0 → qulab-2.12.1}/qulab/utils.py +32 -17
- qulab-2.12.1/qulab/version.py +1 -0
- qulab-2.12.0/qulab/version.py +0 -1
- {qulab-2.12.0 → qulab-2.12.1}/LICENSE +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/MANIFEST.in +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/SOURCES.txt +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/dependency_links.txt +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/entry_points.txt +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/requires.txt +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/QuLab.egg-info/top_level.txt +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/README.md +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/pyproject.toml +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/__main__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/cli/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/cli/config.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/cli/decorators.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/analyze.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/load.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/registry.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/schedule.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/storage.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/template.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/executor/utils.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/__main__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/config.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/dataset.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/event_queue.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/mainwindow.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/monitor.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/ploter.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/qt_compat.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/monitor/toolbar.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/curd.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/models.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/optimize.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/query.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/record.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/scan.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/server.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/space.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/scan/utils.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/__main__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/backend/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/backend/redis.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/base_dataset.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/chunk.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/dataset.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/file.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/base.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/config.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/file.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/ipy.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/models.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/record.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/report.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/models/tag.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/storage/storage.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/chat.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/device/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/device/basedevice.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/device/loader.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/device/utils.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/drivers/FakeInstrument.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/drivers/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/ipy_events.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/bencoder.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/cli.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/dhcp.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/dhcpd.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/kad.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/kcp.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/net/nginx.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/progress.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/client.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/exceptions.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/msgpack.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/msgpack.pyi +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/router.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/rpc.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/serialize.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/server.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/socket.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/utils.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/worker.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/sys/rpc/zmq_socket.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/tools/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/tools/connection_helper.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/typing.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/__init__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/__main__.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/_autoplot.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/plot_circ.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/plot_layout.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/plot_seq.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/qdat.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/rot3d.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/qulab/visualization/widgets.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/setup.cfg +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/setup.py +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/src/qulab.h +0 -0
- {qulab-2.12.0 → qulab-2.12.1}/tests/test_scan.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import click
|
2
2
|
|
3
|
-
from ..executor.cli import (boot, create, export, get, load, maintain,
|
4
|
-
reproduce, run, set)
|
3
|
+
from ..executor.cli import (boot, create, delete, export, get, load, maintain,
|
4
|
+
reboot, reproduce, run, set)
|
5
5
|
from ..monitor.__main__ import main as monitor
|
6
6
|
from ..scan.server import server
|
7
7
|
from ..sys.net.cli import dht
|
@@ -39,3 +39,4 @@ reg.add_command(delete)
|
|
39
39
|
reg.add_command(load)
|
40
40
|
reg.add_command(export)
|
41
41
|
cli.add_command(boot)
|
42
|
+
cli.add_command(reboot)
|
@@ -24,7 +24,7 @@ from .utils import workflow_template
|
|
24
24
|
|
25
25
|
|
26
26
|
@logger.catch(reraise=True)
|
27
|
-
def run_script(script_path, extra_paths=None):
|
27
|
+
def run_script(script_path, args=(), extra_paths=None):
|
28
28
|
"""Run a script in a new process, inheriting current PYTHONPATH plus any extra paths.
|
29
29
|
|
30
30
|
Args:
|
@@ -35,7 +35,7 @@ def run_script(script_path, extra_paths=None):
|
|
35
35
|
import sys
|
36
36
|
|
37
37
|
# Launch the new process with the modified environment
|
38
|
-
proc = subprocess.Popen([sys.executable, script_path],
|
38
|
+
proc = subprocess.Popen([sys.executable, script_path, *args],
|
39
39
|
env=combined_env(extra_paths))
|
40
40
|
proc.communicate()
|
41
41
|
|
@@ -370,6 +370,23 @@ def boot(bootstrap):
|
|
370
370
|
run_script(bootstrap)
|
371
371
|
|
372
372
|
|
373
|
+
@click.command()
|
374
|
+
@click.option('--bootstrap',
|
375
|
+
'-b',
|
376
|
+
default=lambda: get_config_value("bootstrap", Path),
|
377
|
+
help='The path of the bootstrap.')
|
378
|
+
def reboot(bootstrap):
|
379
|
+
"""Reboot the executor.
|
380
|
+
|
381
|
+
Reboots the executor to reset the state and start fresh.
|
382
|
+
|
383
|
+
Args:
|
384
|
+
bootstrap: Path to the bootstrap script
|
385
|
+
"""
|
386
|
+
if bootstrap is not None:
|
387
|
+
run_script(bootstrap, args=('--reboot',))
|
388
|
+
|
389
|
+
|
373
390
|
def parse_dynamic_option_value(value):
|
374
391
|
"""解析动态参数值"""
|
375
392
|
try:
|
@@ -24,33 +24,36 @@ def combined_env(extra_paths=None):
|
|
24
24
|
return env
|
25
25
|
|
26
26
|
|
27
|
-
def run_detached(script, env=None):
|
27
|
+
def run_detached(script, env=None, cwd=None):
|
28
28
|
"""
|
29
29
|
启动可执行文件并完全分离(优先用 tmux/screen),无需额外终端窗口
|
30
30
|
支持 Windows、Linux 和 macOS
|
31
31
|
"""
|
32
32
|
if env is None:
|
33
33
|
env = combined_env()
|
34
|
+
if cwd is None:
|
35
|
+
cwd = os.getcwd()
|
34
36
|
try:
|
35
37
|
if sys.platform == 'win32' or not _unix_detach_with_tmux_or_screen(
|
36
|
-
script, env):
|
38
|
+
script, env, cwd):
|
37
39
|
# 回退到带终端窗口的方案
|
38
|
-
run_detached_with_terminal(script, env)
|
40
|
+
run_detached_with_terminal(script, env, cwd)
|
39
41
|
|
40
42
|
except Exception as e:
|
41
43
|
click.echo(f"启动失败: {e}")
|
42
44
|
sys.exit(1)
|
43
45
|
|
44
46
|
|
45
|
-
def _windows_start(script, env):
|
47
|
+
def _windows_start(script, env, cwd):
|
46
48
|
"""Windows 弹窗启动方案"""
|
47
49
|
subprocess.Popen(f'start cmd /k "{script}"',
|
48
50
|
shell=True,
|
49
51
|
env=env,
|
52
|
+
cwd=cwd,
|
50
53
|
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
|
51
54
|
|
52
55
|
|
53
|
-
def _unix_detach_with_tmux_or_screen(script, env):
|
56
|
+
def _unix_detach_with_tmux_or_screen(script, env, cwd):
|
54
57
|
"""Unix 后台分离方案(无窗口)"""
|
55
58
|
safe_path = shlex.quote(script)
|
56
59
|
session_name = f"qulab_{int(time.time())}"
|
@@ -63,7 +66,7 @@ def _unix_detach_with_tmux_or_screen(script, env):
|
|
63
66
|
"-d",
|
64
67
|
"-s",
|
65
68
|
session_name,
|
66
|
-
|
69
|
+
f"cd {shlex.quote(cwd)} && {script} ; tmux wait-for -S finished", # 等待命令结束
|
67
70
|
";",
|
68
71
|
"tmux",
|
69
72
|
"wait-for",
|
@@ -72,6 +75,7 @@ def _unix_detach_with_tmux_or_screen(script, env):
|
|
72
75
|
subprocess.Popen(" ".join(command),
|
73
76
|
shell=True,
|
74
77
|
env=env,
|
78
|
+
cwd=cwd,
|
75
79
|
start_new_session=True)
|
76
80
|
click.echo(f"已启动 tmux 会话: {session_name}")
|
77
81
|
click.echo(f"你可以使用 `tmux attach -t {session_name}` 来查看输出")
|
@@ -79,8 +83,11 @@ def _unix_detach_with_tmux_or_screen(script, env):
|
|
79
83
|
|
80
84
|
# 尝试 screen
|
81
85
|
elif _check_command_exists("screen", env):
|
82
|
-
command = [
|
83
|
-
|
86
|
+
command = [
|
87
|
+
"screen", "-dmS", session_name, "sh", "-c",
|
88
|
+
f"cd {shlex.quote(cwd)} && {script}"
|
89
|
+
]
|
90
|
+
subprocess.Popen(command, env=env, cwd=cwd, start_new_session=True)
|
84
91
|
click.echo(f"已启动 screen 会话: {session_name}")
|
85
92
|
click.echo(f"你可以使用 `screen -r {session_name}` 来查看输出")
|
86
93
|
return True
|
@@ -88,29 +95,37 @@ def _unix_detach_with_tmux_or_screen(script, env):
|
|
88
95
|
return False
|
89
96
|
|
90
97
|
|
91
|
-
def run_detached_with_terminal(script, env=None):
|
98
|
+
def run_detached_with_terminal(script, env=None, cwd=None):
|
92
99
|
"""回退到带终端窗口的方案"""
|
93
100
|
if env is None:
|
94
101
|
env = combined_env()
|
102
|
+
if cwd is None:
|
103
|
+
cwd = os.getcwd()
|
95
104
|
|
96
105
|
if sys.platform == 'win32':
|
97
|
-
_windows_start(script, env)
|
106
|
+
_windows_start(script, env, cwd)
|
98
107
|
elif sys.platform == 'darwin':
|
99
108
|
# script=shlex.quote(script)
|
100
|
-
|
101
|
-
subprocess.Popen(["osascript", "-e",
|
109
|
+
terminal_script = f'tell app "Terminal" to do script "cd {shlex.quote(cwd)} && {script}"'
|
110
|
+
subprocess.Popen(["osascript", "-e", terminal_script],
|
102
111
|
env=env,
|
112
|
+
cwd=cwd,
|
103
113
|
start_new_session=True)
|
104
114
|
else:
|
105
115
|
try:
|
116
|
+
subprocess.Popen([
|
117
|
+
"gnome-terminal", "--", "sh", "-c",
|
118
|
+
f"cd {shlex.quote(cwd)} && {script}"
|
119
|
+
],
|
120
|
+
env=env,
|
121
|
+
cwd=cwd,
|
122
|
+
start_new_session=True)
|
123
|
+
except FileNotFoundError:
|
106
124
|
subprocess.Popen(
|
107
|
-
["
|
125
|
+
["xterm", "-e", f"sh -c 'cd {shlex.quote(cwd)} && {script}'"],
|
108
126
|
env=env,
|
127
|
+
cwd=cwd,
|
109
128
|
start_new_session=True)
|
110
|
-
except FileNotFoundError:
|
111
|
-
subprocess.Popen(["xterm", "-e", script],
|
112
|
-
env=env,
|
113
|
-
start_new_session=True)
|
114
129
|
|
115
130
|
|
116
131
|
def _check_command_exists(cmd, env):
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "2.12.1"
|
qulab-2.12.0/qulab/version.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "2.12.0"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|