Skip to content

Commit 58d666a

Browse files
committed
rq2: add match options
Problem: rq2 uses the old reapi match allocate function that only allows for 2 match options. Update rq2 match allocate to use use all 4 match options.
1 parent c7fa140 commit 58d666a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

resource/utilities/rq2.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ int match (resource_query_t &ctx, std::vector<std::string> &args,
311311
{
312312
int rc = 0;
313313
int64_t at = 0;
314-
bool orelse_reserve = false;
314+
match_op_t match_op;
315315
bool reserved = false;
316316
bool sat = true;
317317
bool matched = true;
@@ -330,17 +330,19 @@ int match (resource_query_t &ctx, std::vector<std::string> &args,
330330
return 0;
331331
}
332332
std::string subcmd = args[1];
333-
if (!(subcmd == "allocate" || subcmd == "allocate_orelse_reserve"
334-
|| subcmd == "allocate_with_satisfiability"
335-
|| subcmd == "satisfiability")) {
333+
if (subcmd == "allocate") {
334+
match_op = match_op_t::MATCH_ALLOCATE;
335+
} else if (subcmd == "allocate_orelse_reserve") {
336+
match_op = match_op_t::MATCH_ALLOCATE_ORELSE_RESERVE;
337+
} else if (subcmd == "allocate_with_satisfiability") {
338+
match_op = match_op_t::MATCH_ALLOCATE_W_SATISFIABILITY;
339+
} else if (subcmd == "satisfiability") {
340+
match_op = match_op_t::MATCH_SATISFIABILITY;
341+
} else {
336342
std::cerr << "ERROR: unknown subcmd " << args[1] << std::endl;
337343
return 0;
338344
}
339-
340-
if (subcmd == "allocate_orelse_reserve") {
341-
orelse_reserve = true;
342-
}
343-
345+
344346
uint64_t jobid = ctx.get_job_counter ();
345347
std::string &jobspec_fn = args[2];
346348
std::ifstream jobspec_in (jobspec_fn);
@@ -351,7 +353,7 @@ int match (resource_query_t &ctx, std::vector<std::string> &args,
351353
std::string jobspec ( (std::istreambuf_iterator<char> (jobspec_in) ),
352354
(std::istreambuf_iterator<char> () ) );
353355

354-
rc = reapi_cli_t::match_allocate (&ctx, orelse_reserve, jobspec, jobid, reserved, R, at, ov);
356+
rc = reapi_cli_t::match_allocate (&ctx, match_op, jobspec, jobid, reserved, R, at, ov);
355357

356358
// check for match success
357359
if ( (errno == ENODEV) || (errno == EBUSY) || (errno == EINVAL))

0 commit comments

Comments
 (0)