nodeocc 1.0.18__tar.gz → 1.0.19.post1__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.18 → nodeocc-1.0.19.post1}/PKG-INFO +1 -1
  2. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/pyproject.toml +1 -1
  3. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/model/infrastructure.py +6 -1
  4. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/PKG-INFO +1 -1
  5. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/__init__.py +0 -1
  6. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/utils.py +7 -5
  7. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/README.md +0 -0
  8. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/setup.cfg +0 -0
  9. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/setup.py +0 -0
  10. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/__init__.py +0 -0
  11. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/controller/controller.py +0 -0
  12. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/model/job.py +0 -0
  13. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/SOURCES.txt +0 -0
  14. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/dependency_links.txt +0 -0
  15. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/entry_points.txt +0 -0
  16. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/requires.txt +0 -0
  17. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/nodeocc.egg-info/top_level.txt +0 -0
  18. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/readers/compute_wait_time.py +0 -0
  19. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/readers/slurmreader.py +0 -0
  20. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/curses_multiwindow.py +0 -0
  21. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/slurm_list.py +0 -0
  22. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/slurm_viz.py +0 -0
  23. {nodeocc-1.0.18 → nodeocc-1.0.19.post1}/src/view/styles.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nodeocc
3
- Version: 1.0.18
3
+ Version: 1.0.19.post1
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.18"
7
+ version = "1.0.19-1"
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,5 +1,7 @@
1
1
  from typing import List
2
2
 
3
+ from view.utils import to_datetime
4
+
3
5
 
4
6
  class Node:
5
7
  """
@@ -34,7 +36,7 @@ class Maintenance:
34
36
  self.end_time = end_time
35
37
 
36
38
  def __repr__(self):
37
- return f'RESERVATION {self.start_time} - {self.end_time} on {",".join(self.nodes)}'
39
+ return f'RESERVATION - From: {self.start_time} To: {self.end_time} on {",".join(self.nodes)}'
38
40
 
39
41
  @staticmethod
40
42
  def from_dict(d):
@@ -94,3 +96,6 @@ class Infrastructure:
94
96
  def get_sorted_nodes(self):
95
97
 
96
98
  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)
99
+
100
+ def get_next_maintenance(self):
101
+ return sorted(self.maintenances, key=lambda x: to_datetime(x.get('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.18
3
+ Version: 1.0.19.post1
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
@@ -1,4 +1,3 @@
1
- import curses
2
1
  from . import slurm_list, slurm_viz, styles
3
2
 
4
3
 
@@ -1,6 +1,8 @@
1
- import numpy as np
2
1
  import re
3
2
 
3
+ import numpy as np
4
+
5
+
4
6
 
5
7
  def is_student_viz(user):
6
8
  return user.user_group in ('studenti', 'tesisti') and not is_cvcs_viz(user)
@@ -22,7 +24,7 @@ def to_datetime(time_str):
22
24
  return np.datetime64(re.match(r'\d+\s+(.*)\n', str(time_str)).group(1))
23
25
 
24
26
 
25
- def to_datetime(time_str):
27
+ def to_datetime(time_str):
26
28
  try:
27
29
  dt = np.datetime64(re.match(r'\d+\s+(.*)\n', str(time_str)).group(1))
28
30
  except:
@@ -35,9 +37,9 @@ def maintenance_status(infrastructure):
35
37
  waitString = ''
36
38
  if len(infrastructure.maintenances):
37
39
  # time format: '0 2023-12-04 14:00:00\nName: StartTime, dtype: datetime64[ns]'
38
- next_maintenance = sorted(infrastructure.maintenances, key=lambda x: to_datetime(x['start_time']))[0]
39
- start_time = to_datetime(next_maintenance['start_time'])
40
- end_time = to_datetime(next_maintenance['end_time'])
40
+ next_maintenance = infrastructure.get_next_maintenance()
41
+ start_time = to_datetime(next_maintenance.get('start_time'))
42
+ end_time = to_datetime(next_maintenance.get('end_time'))
41
43
  time_to_maintenance = (start_time - np.datetime64('now')).astype(float)
42
44
  # TODO: fix timezone
43
45
  if time_to_maintenance < 0 and (end_time - np.datetime64('now')) > 0:
File without changes
File without changes
File without changes
File without changes