Skip to content

Commit 385f2b0

Browse files
committed
python: fix error message in JobspecV1.per_resource
Problem: If neither ncores or nnodes is specified in the JobspecV1 per_resource constructor, an unhelpful TypeError is raised instead of a useful error. Catch the case where neither ncores or nnodes is specified to this function and raise a specific error message. Fixes #4547
1 parent ff48653 commit 385f2b0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bindings/python/flux/job/Jobspec.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ def per_resource(
746746
# With nnodes, nslots is slots/node (total_slots=slots*nodes)
747747
nslots = 1
748748
slot_size = 1
749+
else:
750+
raise ValueError("must specify node or core count with per_resource")
749751

750752
children = [cls._create_resource("core", slot_size)]
751753
if gpus_per_node:

0 commit comments

Comments
 (0)