mpiptop 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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpiptop
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: TUI for viewing MPI Python stacks across hosts
5
5
  Author: yieldthought
6
6
  License-Expression: MIT
@@ -0,0 +1,7 @@
1
+ mpiptop.py,sha256=9_zUd-erPvVhWOgIjY9YRq-Q6ASb-N95_JEFKzqHwTA,46734
2
+ mpiptop-0.1.1.dist-info/licenses/LICENSE,sha256=ChKmQ8qCXxdXRR_HIJECjIA5NLWlUTEJWh7Xkhm2wAA,1069
3
+ mpiptop-0.1.1.dist-info/METADATA,sha256=qzChya-XoQzIL8YLC5fOoLgWmXvWbrkMz8W7_-EHP5Y,1477
4
+ mpiptop-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ mpiptop-0.1.1.dist-info/entry_points.txt,sha256=RsGsr8GBLfUNpb432YWS5gz4MWfWdK9xJRr1SmdnLo8,41
6
+ mpiptop-0.1.1.dist-info/top_level.txt,sha256=c2Vdu6tTg0DEPUWD8Odyods7fXsPWMQ2kSvjdKiTClc,8
7
+ mpiptop-0.1.1.dist-info/RECORD,,
mpiptop.py CHANGED
@@ -349,6 +349,28 @@ def parse_python_selector(args: str) -> ProgramSelector:
349
349
  return ProgramSelector(module=module, script=script, display=display)
350
350
 
351
351
 
352
+ def selector_score(selector: ProgramSelector) -> Tuple[int, int, int, int]:
353
+ if not selector.display:
354
+ return (0, 0, 0, 0)
355
+ has_script = 1 if selector.script else 0
356
+ has_module = 1 if selector.module else 0
357
+ display = f" {selector.display} "
358
+ has_python_target = 1 if ".py" in selector.display or " -m " in display else 0
359
+ return (has_script, has_module, has_python_target, len(selector.display))
360
+
361
+
362
+ def best_selector_from_procs(procs: Iterable[RankProcess]) -> Optional[ProgramSelector]:
363
+ best: Optional[ProgramSelector] = None
364
+ best_score = selector_score(best or ProgramSelector(module=None, script=None, display=""))
365
+ for proc in procs:
366
+ candidate = parse_python_selector(proc.cmdline)
367
+ score = selector_score(candidate)
368
+ if score > best_score:
369
+ best = candidate
370
+ best_score = score
371
+ return best
372
+
373
+
352
374
  def extract_python_exe(cmdline: str) -> Optional[str]:
353
375
  if not cmdline:
354
376
  return None
@@ -1110,11 +1132,8 @@ def build_header(
1110
1132
  state: State, last_update: str, errors: List[str], refresh: int, width: int
1111
1133
  ) -> Tuple[Text, int]:
1112
1134
  program_lines = wrap_program_lines(state.selector, width)
1113
- if program_lines:
1114
- last_line = program_lines[-1]
1115
- last_line.append(f" | ranks: {len(state.ranks)} | rankfile: {state.rankfile}")
1116
- else:
1117
- program_lines = [Text(f"python | ranks: {len(state.ranks)} | rankfile: {state.rankfile}")]
1135
+ if not program_lines:
1136
+ program_lines = [Text("python")]
1118
1137
 
1119
1138
  controls_plain = "q quit | space refresh | t threads | d details"
1120
1139
  padding = max(0, width - len(controls_plain))
@@ -1339,8 +1358,11 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
1339
1358
  next_refresh = 0.0
1340
1359
 
1341
1360
  def refresh_view() -> None:
1342
- nonlocal last_update
1361
+ nonlocal last_update, state
1343
1362
  rank_to_proc, pid_errors = collect_rank_pids(state)
1363
+ candidate = best_selector_from_procs(rank_to_proc.values())
1364
+ if candidate and selector_score(candidate) > selector_score(state.selector):
1365
+ state = dataclasses.replace(state, selector=candidate)
1344
1366
  stacks, details_by_rank, stack_errors = collect_stacks(
1345
1367
  state, rank_to_proc, pythonpath, show_threads, install_attempted
1346
1368
  )
@@ -1,7 +0,0 @@
1
- mpiptop.py,sha256=nz8YMs0j54vfxDr0bfjwON76QWZ_QAtR2rp0VkuhrFM,45815
2
- mpiptop-0.1.0.dist-info/licenses/LICENSE,sha256=ChKmQ8qCXxdXRR_HIJECjIA5NLWlUTEJWh7Xkhm2wAA,1069
3
- mpiptop-0.1.0.dist-info/METADATA,sha256=VauVpnkAiQokz6X5OXncDhygTbeJPrU_9rOTFya_oMQ,1477
4
- mpiptop-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
- mpiptop-0.1.0.dist-info/entry_points.txt,sha256=RsGsr8GBLfUNpb432YWS5gz4MWfWdK9xJRr1SmdnLo8,41
6
- mpiptop-0.1.0.dist-info/top_level.txt,sha256=c2Vdu6tTg0DEPUWD8Odyods7fXsPWMQ2kSvjdKiTClc,8
7
- mpiptop-0.1.0.dist-info/RECORD,,