@@ -44,6 +44,10 @@ def rpc_allocate(self, jobid, jobspec_str):
44
44
payload = {"cmd" : "allocate" , "jobid" : jobid , "jobspec" : jobspec_str }
45
45
return self .handle .rpc ("sched-fluxion-resource.match" , payload ).get ()
46
46
47
+ def rpc_match_grow (self , jobid , jobspec_str ):
48
+ payload = {"cmd" : "grow_allocation" , "jobid" : jobid , "jobspec" : jobspec_str }
49
+ return self .handle .rpc ("sched-fluxion-resource.match" , payload ).get ()
50
+
47
51
def rpc_update (self , jobid , Res ):
48
52
payload = {"jobid" : jobid , "R" : Res }
49
53
return self .handle .rpc ("sched-fluxion-resource.update" , payload ).get ()
@@ -135,6 +139,23 @@ def match_alloc_action(args):
135
139
print (resp ["R" ])
136
140
137
141
142
+ def match_grow_action (args ):
143
+ """
144
+ Action for match grow sub-command
145
+ """
146
+
147
+ with open (args .jobspec , "r" ) as stream :
148
+ jobspec_str = yaml .dump (yaml .safe_load (stream ))
149
+ jobid = args .jobid
150
+ rmormod = ResourceModuleInterface ()
151
+ resp = rmormod .rpc_match_grow (jobid , jobspec_str )
152
+ print (heading ())
153
+ print (body (resp ["jobid" ], resp ["status" ], resp ["at" ], resp ["overhead" ]))
154
+ print ("=" * width ())
155
+ print ("MATCHED RESOURCES:" )
156
+ print (resp ["R" ])
157
+
158
+
138
159
def match_alloc_sat_action (args ):
139
160
"""
140
161
Action for match allocate_with_satisfiability sub-command
@@ -430,6 +451,10 @@ def parse_match(parser_m: argparse.ArgumentParser):
430
451
parser_ma = subparsers_m .add_parser (
431
452
"allocate" , help = "Allocate the best matching resources if found."
432
453
)
454
+ parser_mg = subparsers_m .add_parser (
455
+ "grow_allocation" ,
456
+ help = "Grow allocation with the best matching resources if found." ,
457
+ )
433
458
parser_ms = subparsers_m .add_parser (
434
459
"allocate_with_satisfiability" ,
435
460
help = (
@@ -451,12 +476,15 @@ def parse_match(parser_m: argparse.ArgumentParser):
451
476
#
452
477
# Jobspec positional argument for all match sub-commands
453
478
#
454
- for subparser in parser_ma , parser_ms , parser_mr , parser_fe :
479
+ for subparser in parser_ma , parser_mg , parser_ms , parser_mr , parser_fe :
455
480
subparser .add_argument (
456
481
"jobspec" , metavar = "Jobspec" , type = str , help = "Jobspec file name"
457
482
)
483
+ # Add jobid positional argument for match grow
484
+ parser_mg .add_argument ("jobid" , metavar = "Jobid" , type = JobID , help = "Jobid" )
458
485
459
486
parser_ma .set_defaults (func = match_alloc_action )
487
+ parser_mg .set_defaults (func = match_grow_action )
460
488
parser_ms .set_defaults (func = match_alloc_sat_action )
461
489
parser_mr .set_defaults (func = match_reserve_action )
462
490
parser_fe .set_defaults (func = satisfiability_action )
0 commit comments