runem 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.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.
- runem/VERSION +1 -1
- runem/blocking_print.py +37 -1
- runem/runem.py +3 -4
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/METADATA +1 -1
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/RECORD +9 -9
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/LICENSE +0 -0
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/WHEEL +0 -0
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/entry_points.txt +0 -0
- {runem-0.3.0.dist-info → runem-0.4.0.dist-info}/top_level.txt +0 -0
runem/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
runem/blocking_print.py
CHANGED
@@ -1,6 +1,40 @@
|
|
1
1
|
import time
|
2
2
|
import typing
|
3
3
|
|
4
|
+
from rich.console import Console
|
5
|
+
|
6
|
+
|
7
|
+
def _reset_console() -> Console:
|
8
|
+
"""Sets the nice user-facing console.
|
9
|
+
|
10
|
+
This function exists so we can reset the output from tests.
|
11
|
+
"""
|
12
|
+
global RICH_CONSOLE # pylint: disable=global-statement
|
13
|
+
|
14
|
+
RICH_CONSOLE = Console(
|
15
|
+
log_path=False, # Do NOT print the source path.
|
16
|
+
markup=False, # Do NOT print markup e.g. `[blink]Don't Panic![/blink]`.
|
17
|
+
)
|
18
|
+
return RICH_CONSOLE
|
19
|
+
|
20
|
+
|
21
|
+
# Overridden in tests.
|
22
|
+
RICH_CONSOLE: Console = _reset_console()
|
23
|
+
|
24
|
+
|
25
|
+
def _reset_console_for_tests() -> None:
|
26
|
+
"""Overrides the console output with more deterministic version.
|
27
|
+
|
28
|
+
... so we can have deterministic tests.
|
29
|
+
"""
|
30
|
+
global RICH_CONSOLE # pylint: disable=global-statement
|
31
|
+
RICH_CONSOLE = Console(
|
32
|
+
log_path=False, # Do NOT print the source path.
|
33
|
+
log_time=False, # Do not prefix with log time e.g. `[time] log message`.
|
34
|
+
markup=False, # Do NOT print markup e.g. `[blink]Don't Panic![/blink]`.
|
35
|
+
width=999, # A very wide width.
|
36
|
+
)
|
37
|
+
|
4
38
|
|
5
39
|
def blocking_print(
|
6
40
|
msg: str = "",
|
@@ -15,9 +49,11 @@ def blocking_print(
|
|
15
49
|
already being written to (for example), i.e. the `print` would need to be a
|
16
50
|
'blocking' call, which it is not.
|
17
51
|
"""
|
52
|
+
if end is None:
|
53
|
+
end = "\n"
|
18
54
|
for _ in range(max_retries):
|
19
55
|
try:
|
20
|
-
print(msg, end=end)
|
56
|
+
RICH_CONSOLE.print(msg, end=end)
|
21
57
|
break # Success, exit the retry loop
|
22
58
|
except BlockingIOError:
|
23
59
|
time.sleep(sleep_time_s) # Wait a bit for the buffer to clear
|
runem/runem.py
CHANGED
@@ -36,6 +36,7 @@ from rich.console import Console, ConsoleOptions, ConsoleRenderable, RenderResul
|
|
36
36
|
from rich.spinner import Spinner
|
37
37
|
from rich.text import Text
|
38
38
|
|
39
|
+
from runem.blocking_print import RICH_CONSOLE
|
39
40
|
from runem.command_line import parse_args
|
40
41
|
from runem.config import load_project_config, load_user_configs
|
41
42
|
from runem.config_metadata import ConfigMetadata
|
@@ -57,8 +58,6 @@ from runem.types.types_jobs import (
|
|
57
58
|
)
|
58
59
|
from runem.utils import printable_set
|
59
60
|
|
60
|
-
rich_console = Console()
|
61
|
-
|
62
61
|
|
63
62
|
def _determine_run_parameters(argv: typing.List[str]) -> ConfigMetadata:
|
64
63
|
"""Loads config, parsing cli input and produces the run config.
|
@@ -143,7 +142,7 @@ def _update_progress(
|
|
143
142
|
|
144
143
|
last_running_jobs_set: typing.Set[str] = set()
|
145
144
|
|
146
|
-
with
|
145
|
+
with RICH_CONSOLE.status(spinner):
|
147
146
|
while is_running.value:
|
148
147
|
running_jobs_set: typing.Set[str] = set(running_jobs.values())
|
149
148
|
|
@@ -157,7 +156,7 @@ def _update_progress(
|
|
157
156
|
spinner.text = report
|
158
157
|
else:
|
159
158
|
if last_running_jobs_set != running_jobs_set:
|
160
|
-
|
159
|
+
RICH_CONSOLE.log(report)
|
161
160
|
|
162
161
|
# Sleep for reduced CPU usage
|
163
162
|
time.sleep(0.1)
|
@@ -1,8 +1,8 @@
|
|
1
|
-
runem/VERSION,sha256=
|
1
|
+
runem/VERSION,sha256=QLjrQACpE6d5EJBTXykdPTaYdBYqie88nj1OiHobnnk,6
|
2
2
|
runem/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
runem/__main__.py,sha256=dsOiVZegpfK9JOs5n7UmbX5iwwbj7iFkEbLoVeEgAn4,136
|
4
4
|
runem/base.py,sha256=EZfR7FIlwEdU9Vfe47Wk2DOO8GQqpKxxLNKp6YHueZ4,316
|
5
|
-
runem/blocking_print.py,sha256=
|
5
|
+
runem/blocking_print.py,sha256=R3c3HSnRMPCf7ykDXdKG2hKH4CzbBaxmOfP3xEU_wEI,1919
|
6
6
|
runem/cli.py,sha256=wEt_Jnumhl8SiOdKdSJzLkJpWv6n3_Odhi_HeIixr1k,134
|
7
7
|
runem/command_line.py,sha256=HsZjxJsVQZLfAeSRI6cpx6P1foeuqCYhHmeQ8Xg9RHY,13774
|
8
8
|
runem/config.py,sha256=UiEU0Jyg5qjrNStvasWYjMOABQHhpZjbPiX3-sH_CMg,5969
|
@@ -21,7 +21,7 @@ runem/log.py,sha256=dIrocigvIJs1ZGkAzTogXkAK-0ZW3q5FkjpDgLdeW-E,630
|
|
21
21
|
runem/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
runem/report.py,sha256=IedwW9mmJfGC6vKQdKDHQH5eoiYzTWHaaD4a3J4e_Pc,9020
|
23
23
|
runem/run_command.py,sha256=Egl_j4bJ9mwi2JEFCsl0W6WH2IRgIdpMN7qdj8voClQ,6386
|
24
|
-
runem/runem.py,sha256=
|
24
|
+
runem/runem.py,sha256=tQg-4e--GmIBJrX3gP8dAUGQTCP6QOPiSSGwKxVmBac,13336
|
25
25
|
runem/runem_version.py,sha256=MbETwZO2Tb1Y3hX_OYZjKepEMKA1cjNvr-7Cqhz6e3s,271
|
26
26
|
runem/utils.py,sha256=3N_kel9LsriiMq7kOjT14XhfxUOgz4hdDg97wlLKm3U,221
|
27
27
|
runem/types/__init__.py,sha256=6TzF4KV9tDGuDTr2qAXmWWkfDU52WuVlQ8Hcz48aYDk,286
|
@@ -34,9 +34,9 @@ runem/types/runem_config.py,sha256=qG_bghm5Nr-ZTbaZbf1v8Fx447V-hgEvvRy5NZ3t-Io,5
|
|
34
34
|
runem/types/types_jobs.py,sha256=wqiiBmRIJDbGlKcfOqewHGKx350w0p4_7pysMm7xGmo,4906
|
35
35
|
tests/test_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
tests/test_types/test_public_api.py,sha256=QHiwt7CetQur65JSbFRnOzQxhCJkX5MVLymHHVd_6yc,160
|
37
|
-
runem-0.
|
38
|
-
runem-0.
|
39
|
-
runem-0.
|
40
|
-
runem-0.
|
41
|
-
runem-0.
|
42
|
-
runem-0.
|
37
|
+
runem-0.4.0.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
|
38
|
+
runem-0.4.0.dist-info/METADATA,sha256=EaVqmVWBeMkJI4tLfI7Nt0A5L3i_OkGCtD_Y8zTJ9kY,5842
|
39
|
+
runem-0.4.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
40
|
+
runem-0.4.0.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
|
41
|
+
runem-0.4.0.dist-info/top_level.txt,sha256=Zu65aVeDPh8WbChU4Mi7-Md4S3XJDPuqdQjEE3DSQno,12
|
42
|
+
runem-0.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|