runem 0.1.0__py3-none-any.whl → 0.1.1__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 CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
runem/hook_manager.py CHANGED
@@ -95,6 +95,7 @@ class HookManager:
95
95
  job_execute(
96
96
  job_config,
97
97
  running_jobs={},
98
+ completed_jobs={},
98
99
  config_metadata=config_metadata,
99
100
  file_lists=file_lists,
100
101
  **kwargs,
runem/job_execute.py CHANGED
@@ -111,6 +111,7 @@ def job_execute_inner(
111
111
  def job_execute(
112
112
  job_config: JobConfig,
113
113
  running_jobs: typing.Dict[str, str],
114
+ completed_jobs: typing.Dict[str, str],
114
115
  config_metadata: ConfigMetadata,
115
116
  file_lists: FilePathListLookup,
116
117
  **kwargs: Unpack[HookSpecificKwargs],
@@ -127,5 +128,6 @@ def job_execute(
127
128
  file_lists,
128
129
  **kwargs,
129
130
  )
131
+ completed_jobs[this_id] = running_jobs[this_id]
130
132
  del running_jobs[this_id]
131
133
  return results
runem/runem.py CHANGED
@@ -28,7 +28,7 @@ import typing
28
28
  from collections import defaultdict
29
29
  from datetime import timedelta
30
30
  from itertools import repeat
31
- from multiprocessing.managers import DictProxy, ListProxy, ValueProxy
31
+ from multiprocessing.managers import DictProxy, ValueProxy
32
32
  from timeit import default_timer as timer
33
33
  from types import TracebackType
34
34
 
@@ -41,7 +41,6 @@ from runem.config import load_project_config, load_user_configs
41
41
  from runem.config_metadata import ConfigMetadata
42
42
  from runem.config_parse import load_config_metadata
43
43
  from runem.files import find_files
44
- from runem.job import Job
45
44
  from runem.job_execute import job_execute
46
45
  from runem.job_filter import filter_jobs
47
46
  from runem.log import error, log, warn
@@ -123,7 +122,7 @@ class DummySpinner(ConsoleRenderable): # pragma: no cover
123
122
  def _update_progress(
124
123
  label: str,
125
124
  running_jobs: typing.Dict[str, str],
126
- seen_jobs: typing.List[str],
125
+ completed_jobs: typing.Dict[str, str],
127
126
  all_jobs: Jobs,
128
127
  is_running: ValueProxy[bool],
129
128
  num_workers: int,
@@ -134,7 +133,6 @@ def _update_progress(
134
133
  Args:
135
134
  label (str): The identifier.
136
135
  running_jobs (Dict[str, str]): The currently running jobs.
137
- seen_jobs (List[str]): Jobs that the function has previously tracked.
138
136
  all_jobs (Jobs): All jobs, encompassing both completed and running jobs.
139
137
  is_running (ValueProxy[bool]): Flag indicating if jobs are still running.
140
138
  num_workers (int): Indicates the number of workers performing the jobs.
@@ -146,47 +144,25 @@ def _update_progress(
146
144
  else:
147
145
  spinner = DummySpinner()
148
146
 
149
- with rich_console.status(spinner):
150
-
151
- # The set of all job labels, and the set of completed jobs
152
- all_job_names: typing.Set[str] = {Job.get_job_name(job) for job in all_jobs}
153
- completed_jobs: typing.Set[str] = set()
154
-
155
- # This dataset is used to track changes between iterations
156
- last_running_jobs_set: typing.Set[str] = set()
147
+ last_running_jobs_set: typing.Set[str] = set()
157
148
 
149
+ with rich_console.status(spinner):
158
150
  while is_running.value:
159
151
  running_jobs_set: typing.Set[str] = set(running_jobs.values())
160
- seen_jobs = list(running_jobs_set.union(seen_jobs)) # Update the seen jobs
161
-
162
- # Jobs that have disappeared since last check
163
- disappeared_jobs: typing.Set[str] = last_running_jobs_set - running_jobs_set
164
-
165
- # Jobs that have not yet completed
166
- remaining_jobs: typing.Set[str] = all_job_names - completed_jobs
167
152
 
168
- # Check if we're closing to completion
169
- workers_retiring: bool = len(remaining_jobs) <= num_workers
170
-
171
- if workers_retiring:
172
- # Handle edge case: a task may have disappeared whilst process was sleeping
173
- all_completed_jobs: typing.Set[str] = all_job_names - remaining_jobs
174
- disappeared_jobs.update(all_completed_jobs - running_jobs_set)
175
-
176
- completed_jobs.update(disappeared_jobs)
177
-
178
- # Prepare progress report
153
+ # Progress report
179
154
  progress: str = f"{len(completed_jobs)}/{len(all_jobs)}"
180
- running_jobs_list = printable_set(running_jobs_set)
155
+ running_jobs_list = printable_set(
156
+ running_jobs_set
157
+ ) # Reflect current running jobs accurately
158
+ report: str = f"{label}: {progress}({num_workers}): {running_jobs_list}"
181
159
  if show_spinner:
182
- spinner.text = (
183
- f"{label}: {progress}({num_workers}): {running_jobs_list}"
184
- )
185
-
186
- # Update the tracked dataset for the next iteration
187
- last_running_jobs_set = running_jobs_set
160
+ spinner.text = report
161
+ else:
162
+ if last_running_jobs_set != running_jobs_set:
163
+ rich_console.log(report)
188
164
 
189
- # Sleep to decrease frequency of updates and reduce CPU usage
165
+ # Sleep for reduced CPU usage
190
166
  time.sleep(0.1)
191
167
 
192
168
 
@@ -225,8 +201,8 @@ def _process_jobs(
225
201
  subprocess_error: typing.Optional[BaseException] = None
226
202
 
227
203
  with multiprocessing.Manager() as manager:
228
- seen_jobs: ListProxy[str] = manager.list()
229
204
  running_jobs: DictProxy[typing.Any, typing.Any] = manager.dict()
205
+ completed_jobs: DictProxy[typing.Any, typing.Any] = manager.dict()
230
206
  is_running: ValueProxy[bool] = manager.Value("b", True)
231
207
 
232
208
  terminal_writer_process = multiprocessing.Process(
@@ -234,7 +210,7 @@ def _process_jobs(
234
210
  args=(
235
211
  phase,
236
212
  running_jobs,
237
- seen_jobs,
213
+ completed_jobs,
238
214
  jobs,
239
215
  is_running,
240
216
  num_concurrent_procs,
@@ -251,6 +227,7 @@ def _process_jobs(
251
227
  zip(
252
228
  jobs,
253
229
  repeat(running_jobs),
230
+ repeat(completed_jobs),
254
231
  repeat(config_metadata),
255
232
  repeat(file_lists),
256
233
  ),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -1,4 +1,4 @@
1
- runem/VERSION,sha256=6d2FB_S_DG9CRY5BrqgzrQvT9hJycjNe7pv01YVB7Wc,6
1
+ runem/VERSION,sha256=gERzFlKfxiAU-6oEf7Z8Uaww4ygwzaNwQFNJ2NZtGWw,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
@@ -9,10 +9,10 @@ runem/config.py,sha256=y-e6j84FDiLSKKw9ShDzRlnS5t2e81MW8fKSKtxtJtg,5935
9
9
  runem/config_metadata.py,sha256=Vy7dx8F-Z5jEp16OP2y6vHHoGkyhoCaTG4KIVkMWR7M,3232
10
10
  runem/config_parse.py,sha256=6mCamzWu7HTotmqFJmLZg9FFE6qe1-rpmo8_v5ESPW8,13401
11
11
  runem/files.py,sha256=QZqPS7OA98lEwlhJNtnaSWlEeTlI8_yn-zjf3QAPoJk,4384
12
- runem/hook_manager.py,sha256=rhQ4bEWSbn7cfLFtIxJwtaiDe7v1ykvUzmpk9BpZFlM,4241
12
+ runem/hook_manager.py,sha256=8zbMuY4FTSm4kDk2wLBa60zl9NfavnmcOR-qL5jhKTc,4276
13
13
  runem/informative_dict.py,sha256=U7p9z78UwOT4TAfng1iDXCEyeYz6C-XZlx9Z1pWNVrI,1548
14
14
  runem/job.py,sha256=QVXvzz67fJk__-h0womFQsB80-w41E3XRcHpxmRnv3o,2912
15
- runem/job_execute.py,sha256=M3hV83SKQMl2kOzVghwbUEYa9B2cQNJR7ixOgxNuWKA,4146
15
+ runem/job_execute.py,sha256=eUyvmtjFdJ49AaIOtqJbRXinkF_UFuz20vBGVrYvt0U,4241
16
16
  runem/job_filter.py,sha256=fuxyKCHpTB4HlT_QagBk-IhhmWMlOr9Y9s5voP4yzYU,5370
17
17
  runem/job_runner_simple_command.py,sha256=jxBukPm9bTLNhfQCkqNG5VepvB2ysmWAZwhBPHoTA6o,1091
18
18
  runem/job_wrapper.py,sha256=H57b52Apcg3q3LyMxus6vNrlv615J4CXiWaQrv8vOgY,936
@@ -21,13 +21,13 @@ runem/log.py,sha256=dIrocigvIJs1ZGkAzTogXkAK-0ZW3q5FkjpDgLdeW-E,630
21
21
  runem/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  runem/report.py,sha256=IBCtMgGwnvVbEEqDWbYBGUZmTIzBLnpXqYSK5uu3vgk,8987
23
23
  runem/run_command.py,sha256=Egl_j4bJ9mwi2JEFCsl0W6WH2IRgIdpMN7qdj8voClQ,6386
24
- runem/runem.py,sha256=IINSRvp0Yytzh-VNY98hPGmxrjyOndSeH0D2eEuyYZA,14303
24
+ runem/runem.py,sha256=TPBVLiZwEAmKNoQZVHBrrMVgHQfcsJM4uVY9lrrp8X8,13207
25
25
  runem/runem_version.py,sha256=MbETwZO2Tb1Y3hX_OYZjKepEMKA1cjNvr-7Cqhz6e3s,271
26
26
  runem/types.py,sha256=-RHnskpWEtvqNlrHx3mHrkx6ujEdkCxcU7hu3_lHrJU,10671
27
27
  runem/utils.py,sha256=3N_kel9LsriiMq7kOjT14XhfxUOgz4hdDg97wlLKm3U,221
28
- runem-0.1.0.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
29
- runem-0.1.0.dist-info/METADATA,sha256=PsBSJX4jHev1NegY-LOjmemYGFFAOR8OUY1-nf2mybE,5842
30
- runem-0.1.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
31
- runem-0.1.0.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
32
- runem-0.1.0.dist-info/top_level.txt,sha256=gK6iqh9OfHDDpErioCC9ul_zx2Q5zWTALtcuGU7Vil4,6
33
- runem-0.1.0.dist-info/RECORD,,
28
+ runem-0.1.1.dist-info/LICENSE,sha256=awOCsWJ58m_2kBQwBUGWejVqZm6wuRtCL2hi9rfa0X4,1211
29
+ runem-0.1.1.dist-info/METADATA,sha256=Eve8gICbiXMPHxQUUtXqB7hU7Dgjq5Gaq-whnLvzCtk,5842
30
+ runem-0.1.1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
31
+ runem-0.1.1.dist-info/entry_points.txt,sha256=nu0g_vBeuPihYtimbtlNusxWovylMppvJ8UxdJlJfvM,46
32
+ runem-0.1.1.dist-info/top_level.txt,sha256=gK6iqh9OfHDDpErioCC9ul_zx2Q5zWTALtcuGU7Vil4,6
33
+ runem-0.1.1.dist-info/RECORD,,
File without changes
File without changes