nodeocc 1.0.5__tar.gz → 1.0.6__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.
Files changed (23) hide show
  1. {nodeocc-1.0.5 → nodeocc-1.0.6}/PKG-INFO +1 -1
  2. {nodeocc-1.0.5 → nodeocc-1.0.6}/pyproject.toml +1 -1
  3. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/PKG-INFO +1 -1
  4. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/curses_multiwindow.py +56 -28
  5. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/slurm_viz.py +1 -1
  6. {nodeocc-1.0.5 → nodeocc-1.0.6}/README.md +0 -0
  7. {nodeocc-1.0.5 → nodeocc-1.0.6}/setup.cfg +0 -0
  8. {nodeocc-1.0.5 → nodeocc-1.0.6}/setup.py +0 -0
  9. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/__init__.py +0 -0
  10. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/controller/controller.py +0 -0
  11. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/model/infrastructure.py +0 -0
  12. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/model/job.py +0 -0
  13. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/SOURCES.txt +0 -0
  14. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/dependency_links.txt +0 -0
  15. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/entry_points.txt +0 -0
  16. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/requires.txt +0 -0
  17. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/nodeocc.egg-info/top_level.txt +0 -0
  18. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/readers/compute_wait_time.py +0 -0
  19. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/readers/slurmreader.py +0 -0
  20. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/__init__.py +0 -0
  21. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/slurm_list.py +0 -0
  22. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/styles.py +0 -0
  23. {nodeocc-1.0.5 → nodeocc-1.0.6}/src/view/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nodeocc
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: TUI application for viewing the status of GPU allocations on a Slurm cluster
5
5
  Author: Matteo Boschini
6
6
  Maintainer: Lorenzo Bonicelli, Aniello Panariello
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nodeocc"
7
- version = "1.0.5"
7
+ version = "1.0.6"
8
8
  authors = [{ name = "Matteo Boschini" }]
9
9
  maintainers = [{ name = "Lorenzo Bonicelli" }, { name = "Aniello Panariello" }]
10
10
  description = "TUI application for viewing the status of GPU allocations on a Slurm cluster"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nodeocc
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: TUI application for viewing the status of GPU allocations on a Slurm cluster
5
5
  Author: Matteo Boschini
6
6
  Maintainer: Lorenzo Bonicelli, Aniello Panariello
@@ -15,6 +15,24 @@ from view import update_views
15
15
 
16
16
  a_filter_values = [None, 'me', 'prod', 'stud', 'cvcs']
17
17
 
18
+ BUTTON_ACTIONS = {
19
+ 'up_1': [ord('w'), curses.KEY_UP, ord('k')],
20
+ 'down_1': [ord('s'), curses.KEY_DOWN, ord('j')],
21
+ 'left_1': [ord('a'), curses.KEY_LEFT, ord('h')],
22
+ 'right_1': [ord('d'), curses.KEY_RIGHT, ord('l')],
23
+ 'up_tab': [curses.KEY_NPAGE],
24
+ 'down_tab': [curses.KEY_PPAGE],
25
+ 'quit': [ord('q'), 'q'],
26
+ 'sort_prio': [ord('S')],
27
+ 'res_view_mode': [ord('g')],
28
+ 'job_id_type': [ord('b')],
29
+ 'show_starttime': [ord('z')],
30
+ 'show_account': [ord('t')],
31
+ 'show_prio': [ord('p')],
32
+ 'refresh': [ord('y')],
33
+ 'info': [ord('i')],
34
+ }
35
+
18
36
 
19
37
  def try_open_socket_as_slave(instance):
20
38
  if not instance.port_file_exists():
@@ -289,8 +307,8 @@ class Buffer(object):
289
307
  xacc += len(chunk)
290
308
  if len(self.buffer) > self.lines - 2:
291
309
  self.screen.addstr(self.lines - 2, instance.xoffset + instance.left_width // 2 - 6, ' ▼ SCROLL ▲ ', curses.color_pair(2) | curses.A_REVERSE)
292
- instance.add_button(self.lines - 2, instance.xoffset + 31, 'D', ord('s'))
293
- instance.add_button(self.lines - 2, instance.xoffset + 40, 'U', ord('w'))
310
+ instance.add_button(self.lines - 2, instance.xoffset + 31, 'D', BUTTON_ACTIONS['down_1'][0])
311
+ instance.add_button(self.lines - 2, instance.xoffset + 40, 'U', BUTTON_ACTIONS['up_1'][0])
294
312
 
295
313
  self.window.border()
296
314
  self.window.noutrefresh()
@@ -330,40 +348,50 @@ def handle_keys(stdscr, instance):
330
348
 
331
349
  # process input
332
350
  # RIGHT
333
- if k == ord('d') or k == 261:
351
+ if k in BUTTON_ACTIONS['right_1']:
334
352
  instance.a_filter = (instance.a_filter + 1) % len(a_filter_values)
335
353
  instance.voff = 0
336
354
  # LEFT
337
- elif k == ord('a') or k == 260:
355
+ elif k in BUTTON_ACTIONS['left_1']:
338
356
  instance.a_filter = (instance.a_filter + (len(a_filter_values) - 1)) % len(a_filter_values)
339
357
  instance.voff = 0
340
358
  elif valid_mouse and isinstance(k, str) and k.startswith('AF_'):
341
359
  instance.a_filter = int(k.split('AF_')[1])
342
360
  # DOWN
343
- elif k == ord('s') or k == 258:
361
+ elif k in BUTTON_ACTIONS['down_1']:
344
362
  instance.voff += 1
345
363
  # UP
346
- elif k == ord('w') or k == 259:
364
+ elif k in BUTTON_ACTIONS['up_1']:
347
365
  instance.voff -= 1
348
366
 
349
- if k == ord('S'):
367
+ elif k in BUTTON_ACTIONS['sort_prio']:
350
368
  instance.sort_by_prio = not instance.sort_by_prio
351
- if k == ord('g'):
352
- instance.view_mode = {"gpu": "ram", "ram": "cpu", "cpu": "gpu"}.get(instance.view_mode, "gpu")
369
+ elif k in BUTTON_ACTIONS['res_view_mode']:
370
+ instance.view_mode = {"gpu": "ram", "ram": "cpu", "cpu": "gpu"}[instance.view_mode]
353
371
  instance.right_width = 33 if instance.view_mode != 'info' else 39
354
372
  stdscr.clear()
355
- if k == ord('j'):
373
+ elif k in BUTTON_ACTIONS['job_id_type']:
356
374
  instance.job_id_type = "true" if instance.job_id_type == "agg" else "agg"
357
- if k == ord('z'):
358
- instance.show_starttime = not instance.show_starttime
359
- if k == ord('t'):
375
+ elif k in BUTTON_ACTIONS['show_starttime']:
376
+ # instance.show_starttime = not instance.show_starttime
377
+ pass
378
+ elif k in BUTTON_ACTIONS['show_account']:
360
379
  instance.show_account = not instance.show_account
361
- if k == ord('p'):
380
+ elif k in BUTTON_ACTIONS['show_prio']:
362
381
  instance.show_prio = not instance.show_prio
363
- if k == ord('i'):
382
+ elif k in BUTTON_ACTIONS['info']:
364
383
  instance.view_mode = 'info' if instance.view_mode != 'info' else 'gpu'
365
384
  instance.right_width = 33 if instance.view_mode != 'info' else 39
366
385
  stdscr.clear()
386
+ elif k in BUTTON_ACTIONS['up_tab']:
387
+ # get screen size
388
+ height, width = stdscr.getmaxyx()
389
+
390
+ instance.voff += ((height - 4) // 2) + 1
391
+ elif k in BUTTON_ACTIONS['down_tab']:
392
+ height, width = stdscr.getmaxyx()
393
+
394
+ instance.voff -= ((height - 4) // 2) + 1
367
395
 
368
396
 
369
397
  def update_screen(stdscr, instance):
@@ -374,7 +402,7 @@ def update_screen(stdscr, instance):
374
402
  lines, columns = os.get_terminal_size().lines, os.get_terminal_size().columns
375
403
  s_lines, s_columns = stdscr.getmaxyx()
376
404
  instance.max_columns = s_columns
377
- if instance.k == ord('y'):
405
+ if instance.k in BUTTON_ACTIONS['refresh']:
378
406
  stdscr.clear()
379
407
 
380
408
  totsize = 106
@@ -415,7 +443,7 @@ def update_screen(stdscr, instance):
415
443
 
416
444
  # render menu
417
445
  stdscr.addstr(lines - 1, xoffset + 1 + 0, '◀')
418
- instance.add_button(lines - 1, xoffset + 1 + 0, '◀', ord('a'))
446
+ instance.add_button(lines - 1, xoffset + 1 + 0, '◀', BUTTON_ACTIONS['left_1'][0])
419
447
  stdscr.addstr(lines - 1, xoffset + 1 + 2, 'ALL', curses.color_pair(2) | (curses.A_REVERSE if a_filter_values[instance.a_filter] is None else 0))
420
448
 
421
449
  instance.add_button(lines - 1, xoffset + 1 + 2, 'ALL', 'AF_0')
@@ -430,42 +458,42 @@ def update_screen(stdscr, instance):
430
458
  instance.add_button(lines - 1, xoffset + 1 + 19, 'CVCS', 'AF_4')
431
459
 
432
460
  stdscr.addstr(lines - 1, xoffset + 1 + 24, '▶')
433
- instance.add_button(lines - 1, xoffset + 1 + 24, '▶', ord('d'))
461
+ instance.add_button(lines - 1, xoffset + 1 + 24, '▶', BUTTON_ACTIONS['right_1'][0])
434
462
  stdscr.addstr(lines - 1, xoffset + 1 + 25, ' ' * (columns - 27 - xoffset))
435
463
 
436
464
  stdscr.addstr(lines - 1, left_width - 8, '[Q:QUIT]', curses.color_pair(2))
437
- instance.add_button(lines - 1, left_width - 8, '[Q:QUIT]', ord('q')) # 53
465
+ instance.add_button(lines - 1, left_width - 8, '[Q:QUIT]', BUTTON_ACTIONS['quit'][0]) # 53
438
466
 
439
467
  stdscr.addstr(lines - 1, left_width - 18 + 19, '[Y:REDRAW]', curses.color_pair(2))
440
- instance.add_button(lines - 1, left_width - 18 + 19, '[Y:REDRAW]', ord('y'))
468
+ instance.add_button(lines - 1, left_width - 18 + 19, '[Y:REDRAW]', BUTTON_ACTIONS['refresh'][0])
441
469
 
442
470
  stdscr.addstr(0, left_width + 2, '[I:', curses.color_pair(2))
443
471
  stdscr.addstr(0, left_width + 5, 'INFO', curses.color_pair(2) | (curses.A_REVERSE if instance.view_mode == 'info' else 0))
444
472
  stdscr.addstr(0, left_width + 9, ']', curses.color_pair(2))
445
- instance.add_button(0, left_width + 2, '[I:INFO]', ord('i'))
473
+ instance.add_button(0, left_width + 2, '[I:INFO]', BUTTON_ACTIONS['info'][0])
446
474
  stdscr.addstr(0, left_width + 10, '─' * (columns - 15 - left_width - 3), curses.color_pair(2))
447
475
  stdscr.addstr(0, columns - 15, '[G:', curses.color_pair(2))
448
476
  stdscr.addstr(0, columns - 12, 'GPU', curses.color_pair(2) | (curses.A_REVERSE if instance.view_mode == 'gpu' else 0))
449
477
  stdscr.addstr(0, columns - 12 + 3, 'RAM', curses.color_pair(2) | (curses.A_REVERSE if instance.view_mode == 'ram' else 0))
450
478
  stdscr.addstr(0, columns - 12 + 6, 'CPU', curses.color_pair(2) | (curses.A_REVERSE if instance.view_mode == 'cpu' else 0))
451
479
  stdscr.addstr(0, columns - 12 + 9, ']', curses.color_pair(2))
452
- instance.add_button(0, columns - 15, '[G:GPURAMCPU]', ord('g'))
480
+ instance.add_button(0, columns - 15, '[G:GPURAMCPU]', BUTTON_ACTIONS['res_view_mode'][0])
453
481
 
454
- stdscr.addstr(lines - 1, xoffset + 25 + 2, '[J:', curses.color_pair(2))
482
+ stdscr.addstr(lines - 1, xoffset + 25 + 2, '[B:', curses.color_pair(2))
455
483
  stdscr.addstr(lines - 1, xoffset + 25 + 2 + 3, 'AGG', curses.color_pair(2) | (curses.A_REVERSE if instance.job_id_type == 'agg' else 0))
456
484
  stdscr.addstr(lines - 1, xoffset + 25 + 2 + 3 + 3, 'TRUE', curses.color_pair(2) | (curses.A_REVERSE if instance.job_id_type == 'true' else 0))
457
485
  stdscr.addstr(lines - 1, xoffset + 25 + 2 + 3 + 3 + 4, ']', curses.color_pair(2))
458
- instance.add_button(lines - 1, xoffset + 25 + 2, '[J:AGGTRUE]', ord('j'))
486
+ instance.add_button(lines - 1, xoffset + 25 + 2, '[B:AGGTRUE]', BUTTON_ACTIONS['job_id_type'][0])
459
487
 
460
488
  stdscr.addstr(lines - 1, xoffset + 37 + 2, '[P:', curses.color_pair(2))
461
489
  stdscr.addstr(lines - 1, xoffset + 37 + 2 + 3, 'PRIORITY', curses.color_pair(2) | (curses.A_REVERSE if instance.show_prio else 0))
462
490
  stdscr.addstr(lines - 1, xoffset + 37 + 2 + 3 + 8, ']', curses.color_pair(2))
463
- instance.add_button(lines - 1, xoffset + 37 + 2, '[P:PRIORITY]', ord('p'))
491
+ instance.add_button(lines - 1, xoffset + 37 + 2, '[P:PRIORITY]', BUTTON_ACTIONS['show_prio'][0])
464
492
 
465
493
  stdscr.addstr(lines - 1, xoffset + 50 + 2, '[T:', curses.color_pair(2))
466
494
  stdscr.addstr(lines - 1, xoffset + 50 + 2 + 3, 'ACCOUNT', curses.color_pair(2) | (curses.A_REVERSE if instance.show_account else 0))
467
495
  stdscr.addstr(lines - 1, xoffset + 50 + 2 + 3 + 7, ']', curses.color_pair(2))
468
- instance.add_button(lines - 1, xoffset + 50 + 2, '[T:ACCOUNT]', ord('t'))
496
+ instance.add_button(lines - 1, xoffset + 50 + 2, '[T:ACCOUNT]', BUTTON_ACTIONS['show_account'][0])
469
497
 
470
498
  # get slurm user partition
471
499
  stdscr.addstr(lines - 1, xoffset + 62 + 2, f'(Avg time {instance.avg_wait_time})', curses.color_pair(2))
@@ -478,7 +506,7 @@ def update_screen(stdscr, instance):
478
506
 
479
507
 
480
508
  def get_char_async(stdscr, instance):
481
- while instance.k != ord('q') and instance.k != 'q':
509
+ while instance.k not in BUTTON_ACTIONS['quit']: # != 'q'
482
510
  handle_keys(stdscr, instance)
483
511
  update_screen(stdscr, instance)
484
512
 
@@ -487,7 +515,7 @@ def get_char_async(stdscr, instance):
487
515
 
488
516
 
489
517
  async def update_screen_info(stdscr, instance):
490
- while instance.k != ord('q') and instance.k != 'q':
518
+ while instance.k not in BUTTON_ACTIONS['quit']:
491
519
  await instance.fetch()
492
520
  instance.log("GOT DATA FROM MASTER")
493
521
  update_screen(stdscr, instance)
@@ -356,7 +356,7 @@ def get_cpu_icon(stat):
356
356
  }.get(stat, cpu_avail)
357
357
 
358
358
 
359
- GPU_MEM = {"K80": 24, "P100": 16, "1080": 11, "TitanXP": 12, "2080": 11, "RTX5000": 16, "RTX6000": 24, "RTXA5000": 24, "A40": 48}
359
+ GPU_MEM = {"K80": 12, "P100": 16, "1080": 11, "TitanXP": 12, "2080": 11, "RTX5000": 16, "RTX6000": 24, "RTXA5000": 24, "A40": 48}
360
360
 
361
361
 
362
362
  def view_viz_cpu(infrastructure, jobs, work=True, stylefn=cmdstyle, current_user=None):
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