Skip to content

Commit

Permalink
Merge pull request #536 from milroy/graph-metadata-update
Browse files Browse the repository at this point in the history
Resource graph metadata update
  • Loading branch information
dongahn authored Oct 14, 2019
2 parents 16e72c3 + 6faf810 commit 8342b7d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions resource/modules/resource_match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ static void set_property_request_cb (flux_t *h, flux_msg_handler_t *w,
string property_key = "", property_value = "";
size_t pos;
resource_ctx_t *ctx = getctx ((flux_t *)arg);
std::map<std::string, std::vector <vtx_t>>::const_iterator it;
std::map<std::string, vtx_t>::const_iterator it;
std::pair<std::map<std::string,std::string>::iterator, bool> ret;
vtx_t v;

Expand Down Expand Up @@ -908,7 +908,7 @@ static void set_property_request_cb (flux_t *h, flux_msg_handler_t *w,
goto error;
}

v = it->second[0];
v = it->second;

ret = ctx->db.resource_graph[v].properties.insert (
std::pair<std::string, std::string> (property_key,property_value));
Expand All @@ -935,7 +935,7 @@ static void get_property_request_cb (flux_t *h, flux_msg_handler_t *w,
const char *rp = NULL, *gp_key = NULL;
string resource_path = "", property_key = "";
resource_ctx_t *ctx = getctx ((flux_t *)arg);
std::map<std::string, std::vector <vtx_t>>::const_iterator it;
std::map<std::string, vtx_t>::const_iterator it;
std::map<std::string, std::string>::const_iterator p_it;
vtx_t v;
string resp_value = "";
Expand All @@ -957,7 +957,7 @@ static void get_property_request_cb (flux_t *h, flux_msg_handler_t *w,
goto error;
}

v = it->second[0];
v = it->second;

for (p_it = ctx->db.resource_graph[v].properties.begin ();
p_it != ctx->db.resource_graph[v].properties.end (); p_it++) {
Expand Down
2 changes: 1 addition & 1 deletion resource/readers/resource_reader_grug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ vtx_t dfs_emitter_t::emit_vertex (ggv_t u, gge_t e, const gg_t &recipe,
//
// Indexing for fast look-up...
//
m.by_path[g[v].paths[ssys]].push_back (v);
m.by_path[g[v].paths[ssys]] = v;
m.by_type[g[v].type].push_back (v);
m.by_name[g[v].name].push_back (v);
return v;
Expand Down
2 changes: 1 addition & 1 deletion resource/readers/resource_reader_hwloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ vtx_t resource_reader_hwloc_t::add_new_vertex (resource_graph_t &g,
g[v].idata.member_of[subsys] = "*";

// Indexing for fast look-up
m.by_path[g[v].paths[subsys]].push_back (v);
m.by_path[g[v].paths[subsys]] = v;
m.by_type[g[v].type].push_back (v);
m.by_name[g[v].name].push_back (v);
return v;
Expand Down
2 changes: 1 addition & 1 deletion resource/readers/resource_reader_jgf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ int resource_reader_jgf_t::add_vtx (resource_graph_t &g,

for (auto kv : g[v].paths) {
g[v].idata.member_of[kv.first] = "*";
m.by_path[kv.second].push_back (v);
m.by_path[kv.second] = v;
if (std::count(kv.second.begin (), kv.second.end (), '/') == 1)
m.roots[kv.first] = v;
}
Expand Down
2 changes: 1 addition & 1 deletion resource/store/resource_graph_store.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct resource_graph_metadata_t {
std::map<subsystem_t, vtx_t> roots;
std::map<std::string, std::vector <vtx_t>> by_type;
std::map<std::string, std::vector <vtx_t>> by_name;
std::map<std::string, std::vector <vtx_t>> by_path;
std::map<std::string, vtx_t> by_path;
};

/*! Resource graph data store.
Expand Down
8 changes: 4 additions & 4 deletions resource/utilities/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ int cmd_set_property (resource_context_t *ctx, std::vector<std::string> &args)
property_value = args[2].substr (pos + 1);
}

std::map<std::string, std::vector <vtx_t>>::const_iterator it =
std::map<std::string, vtx_t>::const_iterator it =
ctx->db.metadata.by_path.find (resource_path);

if (it == ctx->db.metadata.by_path.end ()) {
out << "Couldn't find path " << resource_path
<< " in resource graph." << endl;
}
else {
vtx_t v = it->second[0];
vtx_t v = it->second;

/* Note that map.insert () does not insert if the key exists.
* Assuming we want to update the value though, we do an erase
Expand All @@ -283,15 +283,15 @@ int cmd_get_property (resource_context_t *ctx, std::vector<std::string> &args)
string resource_path = args[1];
ostream &out = (ctx->params.r_fname != "") ? ctx->params.r_out : cout;

std::map<std::string, std::vector <vtx_t>>::const_iterator it =
std::map<std::string, vtx_t>::const_iterator it =
ctx->db.metadata.by_path.find (resource_path);

if (it == ctx->db.metadata.by_path.end ()) {
out << "Could not find path " << resource_path
<< " in resource graph." << endl;
}
else {
vtx_t v = it->second[0];
vtx_t v = it->second;
if (ctx->db.resource_graph[v].properties.size () == 0) {
out << "No properties were found for " << resource_path
<< ". " << endl;
Expand Down
10 changes: 5 additions & 5 deletions resource/utilities/resource-query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ static void usage (int code)
"OPTIONS allow for exporting the filtered graph of the used matcher\n"
"in a selected graph format at the end of the cli session.\n"
"\n"
"To see cli commands, type in \"help\" in the cli: i.e., \n"
" % resource-query> help"
"To see cli commands, type in \"help\" in the cli: i.e.,\n"
" % resource-query> help\n"
"\n"
"\n"
"\n"
Expand Down Expand Up @@ -135,7 +135,7 @@ static void usage (int code)
" C+PA: Containment- and Power-Aware\n"
" IB+IBBA: InfiniBand connection and Bandwidth-Aware\n"
" C+P+IBA: Containment-, Power- and InfiniBand connection-Aware\n"
" VA: Virtual Hierarchy-Aware \n"
" VA: Virtual Hierarchy-Aware\n"
" V+PFS1BA: Virtual Hierarchy and PFS1 Bandwidth-Aware \n"
" ALL: Aware of everything.\n"
" (default=CA).\n"
Expand All @@ -145,8 +145,8 @@ static void usage (int code)
" high: Select resources with high ID first\n"
" low: Select resources with low ID first\n"
" locality: Select contiguous resources first in their ID space\n"
" variation: Allocate resources based on performance classes. "
" (perf_class must be set using set-property). \n"
" variation: Allocate resources based on performance classes.\n"
" (perf_class must be set using set-property).\n"
" (default=high).\n"
"\n"
" -F, --match-format=<simple|pretty_simple|jgf|rlite|rv1|rv1_nosched>\n"
Expand Down

0 comments on commit 8342b7d

Please sign in to comment.