nodeocc 1.0.20__tar.gz → 1.0.22__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.20 → nodeocc-1.0.22}/PKG-INFO +1 -1
  2. {nodeocc-1.0.20 → nodeocc-1.0.22}/pyproject.toml +1 -1
  3. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/model/infrastructure.py +11 -9
  4. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/PKG-INFO +1 -1
  5. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/curses_multiwindow.py +4 -0
  6. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/utils.py +1 -2
  7. {nodeocc-1.0.20 → nodeocc-1.0.22}/README.md +0 -0
  8. {nodeocc-1.0.20 → nodeocc-1.0.22}/setup.cfg +0 -0
  9. {nodeocc-1.0.20 → nodeocc-1.0.22}/setup.py +0 -0
  10. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/__init__.py +0 -0
  11. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/controller/controller.py +0 -0
  12. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/model/job.py +0 -0
  13. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/SOURCES.txt +0 -0
  14. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/dependency_links.txt +0 -0
  15. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/entry_points.txt +0 -0
  16. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/requires.txt +0 -0
  17. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/nodeocc.egg-info/top_level.txt +0 -0
  18. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/readers/compute_wait_time.py +0 -0
  19. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/readers/slurmreader.py +0 -0
  20. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/__init__.py +0 -0
  21. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/slurm_list.py +0 -0
  22. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/slurm_viz.py +0 -0
  23. {nodeocc-1.0.20 → nodeocc-1.0.22}/src/view/styles.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nodeocc
3
- Version: 1.0.20
3
+ Version: 1.0.22
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.20"
7
+ version = "1.0.22"
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,4 +1,4 @@
1
- from typing import List, Optional
1
+ from typing import List
2
2
 
3
3
  from view.utils import to_datetime
4
4
 
@@ -46,7 +46,9 @@ class Maintenance:
46
46
  return m
47
47
 
48
48
  def to_nested_dict(self):
49
- return {k: v for k, v in self.__dict__.items()}
49
+ return {
50
+ k: v for k, v in self.__dict__.items()
51
+ }
50
52
 
51
53
 
52
54
  class Infrastructure:
@@ -76,13 +78,16 @@ class Infrastructure:
76
78
  for k, v in d.items():
77
79
  if k == 'nodes':
78
80
  setattr(i, k, [Node(**n) for n in v])
81
+ elif k == 'maintenances':
82
+ setattr(i, k, [Maintenance.from_dict(m) for m in v])
79
83
  else:
80
84
  setattr(i, k, v)
81
85
  return i
82
86
 
83
87
  def to_nested_dict(self):
84
88
  return {
85
- k: ([n.__dict__ for n in self.nodes] if k == 'nodes' else ([n.to_nested_dict() for n in self.maintenances] if k == 'maintenances' else v))
89
+ k: ([n.__dict__ for n in self.nodes] if k == 'nodes' else
90
+ ([n.to_nested_dict() for n in self.maintenances] if k == 'maintenances' else v))
86
91
  for k, v in self.__dict__.items()
87
92
  }
88
93
 
@@ -91,11 +96,8 @@ class Infrastructure:
91
96
  f"\n\nlimits:({self.gpu_limit_pu}:{self.gpu_limit_grp}),({self.gpu_limit_stu}:{self.gpu_limit_stugrp})"
92
97
 
93
98
  def get_sorted_nodes(self):
99
+
94
100
  return sorted(self.nodes, key=lambda x: self.prior.index(x.gpu_model.split(',')[0]) if x.gpu_model.split(',')[0] in self.prior else -1)
95
101
 
96
- def get_next_maintenance(self) -> Optional[Maintenance]:
97
- if self.maintenances:
98
- if hasattr(self.maintenances[0], 'start_time'): # if it is the master this is a dict
99
- return sorted(self.maintenances, key=lambda x: to_datetime(x.start_time))[0]
100
- return Maintenance(**sorted(self.maintenances, key=lambda x: to_datetime(x.get('start_time')))[0])
101
- return None
102
+ def get_next_maintenance(self):
103
+ return sorted(self.maintenances, key=lambda x: to_datetime(x.start_time))[0] if len(self.maintenances) else None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nodeocc
3
- Version: 1.0.20
3
+ Version: 1.0.22
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
@@ -93,6 +93,8 @@ class Singleton:
93
93
  def clean_port_files(self):
94
94
  nodename = socket.getfqdn().split('.')[0]
95
95
  bp = os.path.join(self.basepath, nodename)
96
+ if not os.path.exists(bp):
97
+ return True
96
98
  for f in os.listdir(bp):
97
99
  if 'master_' in f and f.endswith('.portfile') and is_file_writable_byall(os.path.join(bp, f)):
98
100
  # read pid from file
@@ -167,6 +169,8 @@ class Singleton:
167
169
  """
168
170
  nodename = socket.getfqdn().split('.')[0]
169
171
  bp = os.path.join(self.basepath, nodename)
172
+ if not os.path.exists(bp):
173
+ return []
170
174
  portfiles = [os.path.join(bp, f) for f in os.listdir(bp)
171
175
  if f.endswith('.portfile') and 'master_' in f]
172
176
  portfiles = [f for f in portfiles if is_file_readable_byall(f) and is_file_writable_byall(f)]
@@ -3,7 +3,6 @@ import re
3
3
  import numpy as np
4
4
 
5
5
 
6
-
7
6
  def is_student_viz(user):
8
7
  return user.user_group in ('studenti', 'tesisti') and not is_cvcs_viz(user)
9
8
 
@@ -27,7 +26,7 @@ def to_datetime(time_str):
27
26
  def to_datetime(time_str):
28
27
  try:
29
28
  dt = np.datetime64(re.match(r'\d+\s+(.*)\n', str(time_str)).group(1))
30
- except:
29
+ except BaseException:
31
30
  dt = np.datetime64(str(time_str))
32
31
  return dt
33
32
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes