richqueue 1.7__tar.gz → 1.8__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: richqueue
3
- Version: 1.7
3
+ Version: 1.8
4
4
  Summary: RichQueue
5
5
  Project-URL: Homepage, https://github.com/mwinokan/RichQueue/issues
6
6
  Project-URL: Bug Tracker, https://github.com/mwinokan/RichQueue/issues
@@ -3,7 +3,7 @@ requires = ["hatchling"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "richqueue"
6
- version = "1.7"
6
+ version = "1.8"
7
7
  authors = [
8
8
  { name = "Max Winokan", email = "max@winokan.com" },
9
9
  ]
@@ -33,25 +33,15 @@ def get_layout_pair(user: str | None, console_height=None, **kwargs):
33
33
 
34
34
  df = combined_df(user=user, **kwargs)
35
35
 
36
- # if df is None:
37
- # running = Panel(Text("[bold]No active jobs"), expand=False)
38
- # else:
39
-
40
36
  n_rows = len(df)
41
37
  n_running = len(df[df["job_state"] == "RUNNING"])
42
38
  n_pending = len(df[df["job_state"] == "PENDING"])
43
39
 
44
40
  hide_pending = False
45
41
 
46
- # print(console_height)
47
-
48
42
  if console_height is None:
49
43
  console_height = console.size.height
50
44
 
51
- # print(console_height)
52
- # print(n_running)
53
- # print(n_pending)
54
-
55
45
  history_df = df[~df["job_state"].isin(["RUNNING", "PENDING"])]
56
46
 
57
47
  if n_running + n_pending > 0:
@@ -71,7 +61,6 @@ def get_layout_pair(user: str | None, console_height=None, **kwargs):
71
61
 
72
62
  # hide pending?
73
63
  elif n_rows - n_pending < max_rows:
74
- # running_df = running_df[running_df["job_state"]=="RUNNING"]
75
64
  running_limit = None
76
65
  history_limit = None
77
66
  hide_pending = n_pending
@@ -410,15 +399,14 @@ def combined_df(**kwargs) -> "DataFrame":
410
399
  def add_run_time(df):
411
400
 
412
401
  def inner(row):
413
- # print(f'{row.end_time=} {type(row.end_time)=}')
414
402
 
415
403
  if row.job_state == "PENDING":
416
404
  return ""
417
405
 
418
- if isnull(row.end_time):
419
- return human_timedelta(datetime.datetime.now() - row.start_time)
420
- else:
421
- return human_timedelta(row.end_time - row.start_time)
406
+ if "end_time" not in row or isnull(row.end_time):
407
+ row.end_time = datetime.datetime.now()
408
+
409
+ return human_timedelta(row.end_time - row.start_time)
422
410
 
423
411
  return df.apply(inner, axis=1)
424
412
 
@@ -38,7 +38,7 @@ def running_job_table(
38
38
 
39
39
  table = Table(title=title, box=None, header_style="")
40
40
 
41
- columns = RUNNING_JOB_COLUMNS[long]
41
+ columns = RUNNING_JOB_COLUMNS(long, user)
42
42
 
43
43
  for col in columns:
44
44
  col_data = COLUMNS[col]
@@ -99,13 +99,15 @@ def history_job_table(
99
99
  hist_string = f"last {hist} {hist_unit}"
100
100
 
101
101
  if not user:
102
- title = f"[bold]{count} previous jobs on {METADATA['cluster_name']} ({hist_string})"
102
+ title = (
103
+ f"[bold]{count} previous jobs on {METADATA['cluster_name']} ({hist_string})"
104
+ )
103
105
  else:
104
106
  title = f"[bold]{user}'s {count} previous jobs on {METADATA['cluster_name']} ({hist_string})"
105
107
 
106
108
  table = Table(title=title, box=None, header_style="")
107
109
 
108
- columns = HISTORY_JOB_COLUMNS[long]
110
+ columns = HISTORY_JOB_COLUMNS(long, user)
109
111
 
110
112
  for col in columns:
111
113
  col_data = COLUMNS[col]
@@ -283,7 +285,9 @@ def color_by_state(state):
283
285
  elif state == "IDLE":
284
286
  return "[bold bright_green]Idle"
285
287
  elif state == "PENDING":
286
- return "[bright_red]Preempted"
288
+ return "[bright_yellow]Preempted"
289
+ elif state == "NODE_FAIL":
290
+ return "[bold bright_red]Node Failure"
287
291
  elif state == "PREEMPTED":
288
292
  return "[bright_yellow]Pending"
289
293
  elif state == "MIXED":
@@ -387,55 +391,118 @@ JOB_COLUMNS = {
387
391
  ],
388
392
  }
389
393
 
390
- RUNNING_JOB_COLUMNS = {
391
- True: [
392
- "job_id",
393
- "name",
394
- "node_count",
395
- "cpus",
396
- "submit_time",
397
- "start_time",
398
- "run_time",
399
- "time_limit",
400
- "partition",
401
- "nodes",
402
- "job_state",
403
- ],
404
- False: [
405
- "job_id",
406
- "name",
407
- "node_count",
408
- "cpus",
409
- "start_time",
410
- "run_time",
411
- "time_limit",
412
- "job_state",
413
- ],
414
- }
415
394
 
416
- HISTORY_JOB_COLUMNS = {
417
- True: [
418
- "job_id",
419
- "name",
420
- # "node_count",
421
- # "cpus",
422
- "submit_time",
423
- "start_time",
424
- "run_time",
425
- "partition",
426
- "nodes",
427
- "job_state",
428
- ],
429
- False: [
430
- "job_id",
431
- "name",
432
- # "node_count",
433
- # "cpus",
434
- "start_time",
435
- "run_time",
436
- "job_state",
437
- ],
438
- }
395
+ def RUNNING_JOB_COLUMNS(long, user):
396
+ if user:
397
+ if long:
398
+ return [
399
+ "job_id",
400
+ "name",
401
+ "node_count",
402
+ "cpus",
403
+ "submit_time",
404
+ "start_time",
405
+ "run_time",
406
+ "time_limit",
407
+ "partition",
408
+ "nodes",
409
+ "job_state",
410
+ ]
411
+
412
+ else:
413
+ return [
414
+ "job_id",
415
+ "name",
416
+ "node_count",
417
+ "cpus",
418
+ "start_time",
419
+ "run_time",
420
+ "time_limit",
421
+ "job_state",
422
+ ]
423
+ else:
424
+ if long:
425
+ return [
426
+ "job_id",
427
+ "user_name",
428
+ "name",
429
+ "node_count",
430
+ "cpus",
431
+ "submit_time",
432
+ "start_time",
433
+ "run_time",
434
+ "time_limit",
435
+ "partition",
436
+ "nodes",
437
+ "job_state",
438
+ ]
439
+
440
+ else:
441
+ return [
442
+ "job_id",
443
+ "user_name",
444
+ "name",
445
+ "node_count",
446
+ "cpus",
447
+ "start_time",
448
+ "run_time",
449
+ "time_limit",
450
+ "job_state",
451
+ ]
452
+
453
+
454
+ def HISTORY_JOB_COLUMNS(long, user):
455
+ if user:
456
+ if long:
457
+ return [
458
+ "job_id",
459
+ "name",
460
+ # "node_count",
461
+ # "cpus",
462
+ "submit_time",
463
+ "start_time",
464
+ "run_time",
465
+ "partition",
466
+ "nodes",
467
+ "job_state",
468
+ ]
469
+ else:
470
+ return [
471
+ "job_id",
472
+ "name",
473
+ # "node_count",
474
+ # "cpus",
475
+ "start_time",
476
+ "run_time",
477
+ "job_state",
478
+ ]
479
+ else:
480
+ if long:
481
+ return [
482
+ "job_id",
483
+ "user_name",
484
+ "name",
485
+ # "node_count",
486
+ # "cpus",
487
+ "submit_time",
488
+ "start_time",
489
+ "run_time",
490
+ "partition",
491
+ "nodes",
492
+ "job_state",
493
+ ]
494
+ else:
495
+ return [
496
+ "job_id",
497
+ "user_name",
498
+ "name",
499
+ # "node_count",
500
+ # "cpus",
501
+ "start_time",
502
+ "run_time",
503
+ "job_state",
504
+ ]
505
+
439
506
 
440
507
  NODE_COLUMNS = {
441
508
  True: [
@@ -585,7 +652,10 @@ COLUMNS = {
585
652
  "no_wrap": True,
586
653
  },
587
654
  "threads_per_core": {"header": "#Threads/core", "style": "magenta"},
588
- "user_name": {"header": "User Group", "style": "green_yellow"},
655
+ "user_name": {
656
+ "header": "[bold underline green_yellow]User",
657
+ "style": "green_yellow",
658
+ },
589
659
  }
590
660
 
591
661
  FORMATTERS = {
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