Skip to content

Commit 4865124

Browse files
committed
Some fixes to Node API due to backporting
1 parent 401cfad commit 4865124

File tree

3 files changed

+3
-78
lines changed

3 files changed

+3
-78
lines changed

pyslurm/core/node.pxd

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ from pyslurm.slurm cimport (
3333
slurm_load_node,
3434
slurm_load_node_single,
3535
slurm_update_node,
36-
slurm_delete_node,
37-
slurm_create_node,
3836
slurm_load_partitions,
3937
slurm_free_update_node_msg,
4038
slurm_init_update_node_msg,
@@ -77,8 +75,6 @@ cdef class Nodes(dict):
7775
Total amount of idle CPUs in this node collection.
7876
allocated_cpus (int):
7977
Total amount of allocated CPUs in this node collection.
80-
effective_cpus (int):
81-
Total amount of effective CPUs in this node collection.
8278
current_watts (int):
8379
Total amount of Watts consumed in this node collection.
8480
avg_watts (int):
@@ -166,8 +162,6 @@ cdef class Node:
166162
Amount of temporary disk space this node has, in Mebibytes.
167163
weight (int):
168164
Weight of the node in scheduling.
169-
effective_cpus (int):
170-
Number of effective CPUs the node has.
171165
total_cpus (int):
172166
Total amount of CPUs the node has.
173167
sockets (int):

pyslurm/core/node.pyx

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ cdef class Nodes(dict):
185185
def allocated_cpus(self):
186186
return _sum_prop(self, Node.allocated_cpus)
187187

188-
@property
189-
def effective_cpus(self):
190-
return _sum_prop(self, Node.effective_cpus)
191-
192188
@property
193189
def current_watts(self):
194190
return _sum_prop(self, Node.current_watts)
@@ -308,38 +304,6 @@ cdef class Node:
308304

309305
return wrap
310306

311-
def create(self, state="future"):
312-
"""Create a node.
313-
314-
Implements the slurm_create_node RPC.
315-
316-
Args:
317-
state (str, optional):
318-
An optional state the created Node should have. Allowed values
319-
are "future" and "cloud". "future" is the default.
320-
321-
Returns:
322-
(pyslurm.Node): This function returns the current Node-instance
323-
object itself.
324-
325-
Raises:
326-
RPCError: If creating the Node was not successful.
327-
MemoryError: If malloc failed to allocate memory.
328-
329-
Examples:
330-
>>> import pyslurm
331-
>>> node = pyslurm.Node("testnode").create()
332-
"""
333-
if not self.name:
334-
raise ValueError("You need to set a node name first.")
335-
336-
self._alloc_umsg()
337-
cstr.fmalloc(&self.umsg.extra,
338-
f"NodeName={self.name} State={state}")
339-
verify_rpc(slurm_create_node(self.umsg))
340-
341-
return self
342-
343307
def modify(self, changes):
344308
"""Modify a node.
345309
@@ -366,22 +330,6 @@ cdef class Node:
366330
cstr.fmalloc(&n.umsg.node_names, self.name)
367331
verify_rpc(slurm_update_node(n.umsg))
368332

369-
def delete(self):
370-
"""Delete a node.
371-
372-
Implements the slurm_delete_node RPC.
373-
374-
Raises:
375-
RPCError: If deleting the Node was not successful.
376-
MemoryError: If malloc failed to allocate memory.
377-
378-
Examples:
379-
>>> import pyslurm
380-
>>> pyslurm.Node("localhost").delete()
381-
"""
382-
self._alloc_umsg()
383-
verify_rpc(slurm_delete_node(self.umsg))
384-
385333
def as_dict(self):
386334
"""Node information formatted as a dictionary.
387335
@@ -515,10 +463,6 @@ cdef class Node:
515463
def weight(self, val):
516464
self.info.weight=self.umsg.weight = u32(val)
517465

518-
@property
519-
def effective_cpus(self):
520-
return u16_parse(self.info.cpus_efctv)
521-
522466
@property
523467
def total_cpus(self):
524468
return u16_parse(self.info.cpus, on_noval=0)
@@ -610,11 +554,11 @@ cdef class Node:
610554

611555
@property
612556
def idle_cpus(self):
613-
efctv = self.effective_cpus
614-
if not efctv:
557+
tot = self.total_cpus
558+
if not tot:
615559
return None
616560

617-
return efctv - self.allocated_cpus
561+
return tot - self.allocated_cpus
618562

619563
@property
620564
def cpu_binding(self):

tests/integration/test_node.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,6 @@ def test_load():
4242
Node.load("nonexistent")
4343

4444

45-
def test_create():
46-
node = Node("testhostpyslurm")
47-
node.create()
48-
49-
with pytest.raises(RPCError,
50-
match=f"Invalid node state specified"):
51-
Node("testhostpyslurm2").create("idle")
52-
53-
54-
# def test_delete():
55-
# node = Node("testhost1").delete()
56-
57-
5845
def test_modify():
5946
node = Node(Nodes.load().as_list()[0].name)
6047

0 commit comments

Comments
 (0)