Skip to content

Commit

Permalink
reapi: add overloaded info function to reapi_cli_t
Browse files Browse the repository at this point in the history
Problem: current info function only provides a subset of fields
from job_info_t.

Add in an overloaded info function that sets a shared pointed for
job_info_t.
  • Loading branch information
zekemorton committed Dec 4, 2023
1 parent 4cc258b commit bb7469a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resource/reapi/bindings/c++/reapi_cli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class reapi_cli_t : public reapi_t {
static int find (void *h, std::string criteria, json_t *&o );
static int info (void *h, const uint64_t jobid, std::string &mode,
bool &reserved, int64_t &at, double &ov);
static int info (void *h, const uint64_t jobid,
std::shared_ptr<job_info_t> &job);
static int stat (void *h, int64_t &V, int64_t &E,int64_t &J,
double &load, double &min, double &max, double &avg);
static const std::string &get_err_message ();
Expand Down
16 changes: 16 additions & 0 deletions resource/reapi/bindings/c++/reapi_cli_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,22 @@ int reapi_cli_t::info (void *h, const uint64_t jobid, std::string &mode,
return 0;
}

int reapi_cli_t::info (void *h, const uint64_t jobid,
std::shared_ptr<job_info_t> &job)
{
resource_query_t *rq = static_cast<resource_query_t *> (h);

if ( !(rq->job_exists (jobid))) {
m_err_msg += __FUNCTION__;
m_err_msg += ": ERROR: nonexistent job "
+ std::to_string (jobid) + "\n";
return -1;
}

job = rq->get_job (jobid);
return 0;
}

int reapi_cli_t::stat (void *h, int64_t &V, int64_t &E,int64_t &J,
double &load, double &min, double &max, double &avg)
{
Expand Down

0 comments on commit bb7469a

Please sign in to comment.