Skip to content

Commit 579c193

Browse files
committed
test: add set-status command to flux ion-resource
Problem: there is no convenient testing interface to the set-status resource service. Add a command to the flux-ion-resource script for sending a set-status RPC.
1 parent d9dbb22 commit 579c193

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

t/scripts/flux-ion-resource.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def rpc_find(self, criteria, find_format=None):
9494
def rpc_status(self):
9595
return self.f.rpc("sched-fluxion-resource.status").get()
9696

97+
def rpc_set_status(self, resource_path, status):
98+
payload = {"resource_path": resource_path, "status": status}
99+
return self.f.rpc("sched-fluxion-resource.set_status", payload).get()
100+
97101
def rpc_namespace_info(self, rank, type_name, identity):
98102
payload = {"rank": rank, "type-name": type_name, "id": identity}
99103
return self.f.rpc("sched-fluxion-resource.ns-info", payload).get()
@@ -288,6 +292,16 @@ def status_action(args):
288292
print(json.dumps(resp))
289293

290294

295+
"""
296+
Action for set-status sub-command
297+
"""
298+
299+
300+
def set_status_action(args):
301+
r = ResourceModuleInterface()
302+
r.rpc_set_status(args.resource_path, args.status)
303+
304+
291305
"""
292306
Action for ns-info sub-command
293307
"""
@@ -341,6 +355,7 @@ def main():
341355
cstr = "Cancel an allocated or reserved job."
342356
fstr = "Find resources matching with a crieria."
343357
ststr = "Display resource status."
358+
ssstr = "Set up/down status of a resource vertex."
344359
pstr = "Set property-key=value for specified resource."
345360
gstr = "Get value for specified resource and property-key."
346361
nstr = "Get remapped ID given raw ID seen by the reader."
@@ -352,6 +367,7 @@ def main():
352367
parser_c = subpar.add_parser("cancel", help=cstr, description=cstr)
353368
parser_f = subpar.add_parser("find", help=fstr, description=fstr)
354369
parser_st = subpar.add_parser("status", help=ststr, description=ststr)
370+
parser_ss = subpar.add_parser("set-status", help=ssstr, description=ssstr)
355371
parser_sp = subpar.add_parser("set-property", help=pstr, description=pstr)
356372
parser_gp = subpar.add_parser("get-property", help=gstr, description=gstr)
357373
parser_n = subpar.add_parser("ns-info", help=nstr, description=nstr)
@@ -419,6 +435,18 @@ def main():
419435
st_help = "Resource status"
420436
parser_st.set_defaults(func=status_action)
421437

438+
# Positional argument for set-status sub-command
439+
#
440+
parser_ss.add_argument(
441+
"resource_path",
442+
help="path to vertex",
443+
)
444+
parser_ss.add_argument(
445+
"status",
446+
help="status of vertex",
447+
)
448+
parser_ss.set_defaults(func=set_status_action)
449+
422450
#
423451
# Positional argument for match allocate sub-command
424452
#

0 commit comments

Comments
 (0)