Skip to content

Commit e56193b

Browse files
committed
resource: add support for jgf_shorthand in update
Problem: resource-query does not support using the jgf_shorthand reader to perform the `update` command. Add support.
1 parent 798ab3a commit e56193b

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

resource/utilities/command.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ command_t commands[] =
5050
"u",
5151
cmd_update,
5252
"Update resources with a JGF subgraph (subcmd: "
53-
"allocate | reserve), (reader: jgf | rv1exec): "
53+
"allocate | reserve), (reader: jgf | jgf_shorthand | rv1exec): "
5454
"resource-query> update allocate jgf jgf_file jobid starttime duration"},
5555
{"attach",
5656
"j",
@@ -365,16 +365,9 @@ static int update_run (std::shared_ptr<detail::resource_query_t> &ctx,
365365
struct timeval st, et;
366366
std::shared_ptr<resource_reader_base_t> rd;
367367

368-
if (reader == "jgf") {
369-
if ((rd = create_resource_reader ("jgf")) == nullptr) {
370-
std::cerr << "ERROR: can't create JGF reader " << std::endl;
371-
return -1;
372-
}
373-
} else {
374-
if ((rd = create_resource_reader ("rv1exec")) == nullptr) {
375-
std::cerr << "ERROR: can't create rv1exec reader " << std::endl;
376-
return -1;
377-
}
368+
if ((rd = create_resource_reader (reader)) == nullptr) {
369+
std::cerr << "ERROR: can't create '" << reader << "' reader " << std::endl;
370+
return -1;
378371
}
379372

380373
gettimeofday (&st, NULL);
@@ -417,7 +410,7 @@ static int update (std::shared_ptr<detail::resource_query_t> &ctx,
417410
std::cerr << "ERROR: unknown subcmd " << args[1] << std::endl;
418411
return -1;
419412
}
420-
if (!(reader == "jgf" || reader == "rv1exec")) {
413+
if (!(reader == "jgf" || reader == "rv1exec" || reader == "jgf_shorthand")) {
421414
std::cerr << "ERROR: unsupported reader " << args[2] << std::endl;
422415
return -1;
423416
}

0 commit comments

Comments
 (0)