From 0ebd24fe0c9714b052850c1ba1f24c763e73aa6d Mon Sep 17 00:00:00 2001 From: Zeke Morton Date: Thu, 20 Jul 2023 15:45:11 -0700 Subject: [PATCH 1/3] readers: remove subgraph feature Problem: adding elasicity into fluxion requires the addition of a new feature to remove subgraphs from the resource graph. This implementation removes nodes from the resource graph metadata and clears the node of edges. This makes those nodes essentially unreachable through traversal or look up from the metadata. Actually deleting nodes from the resource graph would invalidate the vertex descriptors and resource graph metadata. This is because the resource graph is using a vecS instead of a listS for the Boost adjacency list. --- resource/readers/resource_reader_base.hpp | 4 + resource/readers/resource_reader_grug.cpp | 8 + resource/readers/resource_reader_grug.hpp | 4 + resource/readers/resource_reader_hwloc.cpp | 9 +- resource/readers/resource_reader_hwloc.hpp | 4 + resource/readers/resource_reader_jgf.cpp | 179 +++++++++++++++++-- resource/readers/resource_reader_jgf.hpp | 30 +++- resource/readers/resource_reader_rv1exec.cpp | 12 +- resource/readers/resource_reader_rv1exec.hpp | 4 + 9 files changed, 228 insertions(+), 26 deletions(-) diff --git a/resource/readers/resource_reader_base.hpp b/resource/readers/resource_reader_base.hpp index 1dc00f5f9..02d8483a5 100644 --- a/resource/readers/resource_reader_base.hpp +++ b/resource/readers/resource_reader_base.hpp @@ -53,6 +53,10 @@ class resource_reader_base_t { virtual int unpack_at (resource_graph_t &g, resource_graph_metadata_t &m, vtx_t &vtx, const std::string &str, int rank = -1) = 0; + virtual int remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path) = 0; + /*! Update resource graph g with str. * * \param g resource graph diff --git a/resource/readers/resource_reader_grug.cpp b/resource/readers/resource_reader_grug.cpp index 54e0bbcc5..20d9045ec 100644 --- a/resource/readers/resource_reader_grug.cpp +++ b/resource/readers/resource_reader_grug.cpp @@ -481,6 +481,14 @@ int resource_reader_grug_t::unpack_at (resource_graph_t &g, return -1; } +int resource_reader_grug_t::remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path) +{ + errno = ENOTSUP; // GRUG reader does not support remove + return -1; +} + int resource_reader_grug_t::update (resource_graph_t &g, resource_graph_metadata_t &m, const std::string &str, int64_t jobid, diff --git a/resource/readers/resource_reader_grug.hpp b/resource/readers/resource_reader_grug.hpp index 6e4bd80b2..0ecf6ebc0 100644 --- a/resource/readers/resource_reader_grug.hpp +++ b/resource/readers/resource_reader_grug.hpp @@ -52,6 +52,10 @@ class resource_reader_grug_t : public resource_reader_base_t { virtual int unpack_at (resource_graph_t &g, resource_graph_metadata_t &m, vtx_t &vtx, const std::string &str, int rank = -1); + virtual int remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path); + /*! Update resource graph g with str. * * \param g resource graph diff --git a/resource/readers/resource_reader_hwloc.cpp b/resource/readers/resource_reader_hwloc.cpp index c34c11a62..68dc18c56 100644 --- a/resource/readers/resource_reader_hwloc.cpp +++ b/resource/readers/resource_reader_hwloc.cpp @@ -296,7 +296,7 @@ int resource_reader_hwloc_t::walk_hwloc (resource_graph_t &g, rc = -1; break; } - if (remap_id + if (remap_id > static_cast (std::numeric_limits::max ())) { errno = EOVERFLOW; m_err_msg += "Remapped gpu id too large; "; @@ -508,6 +508,13 @@ int resource_reader_hwloc_t::unpack_at (resource_graph_t &g, return unpack_internal (g, m, vtx, str, rank); } +int resource_reader_hwloc_t::remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path) +{ + errno = ENOTSUP; // hwloc reader does not support remove + return -1; +} int resource_reader_hwloc_t::update (resource_graph_t &g, resource_graph_metadata_t &m, const std::string &str, int64_t jobid, diff --git a/resource/readers/resource_reader_hwloc.hpp b/resource/readers/resource_reader_hwloc.hpp index 9f71fbf7c..9817eda41 100644 --- a/resource/readers/resource_reader_hwloc.hpp +++ b/resource/readers/resource_reader_hwloc.hpp @@ -56,6 +56,10 @@ class resource_reader_hwloc_t : public resource_reader_base_t { virtual int unpack_at (resource_graph_t &g, resource_graph_metadata_t &m, vtx_t &vtx, const std::string &str, int rank = -1); + virtual int remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path); + /*! Update resource graph g with str. * * \param g resource graph diff --git a/resource/readers/resource_reader_jgf.cpp b/resource/readers/resource_reader_jgf.cpp index e166863bf..efefbbef5 100644 --- a/resource/readers/resource_reader_jgf.cpp +++ b/resource/readers/resource_reader_jgf.cpp @@ -282,7 +282,7 @@ int resource_reader_jgf_t::unpack_and_remap_vtx (fetch_helper_t &f, m_err_msg += std::to_string (f.rank) + ".\n"; goto error; } - if (remap_rank + if (remap_rank > static_cast (std::numeric_limits::max ())) { errno = EOVERFLOW; m_err_msg += __FUNCTION__; @@ -298,7 +298,7 @@ int resource_reader_jgf_t::unpack_and_remap_vtx (fetch_helper_t &f, m_err_msg += " rank=" + std::to_string (f.rank) + ".\n"; goto error; } - if (remap_id + if (remap_id > static_cast (std::numeric_limits::max ())) { errno = EOVERFLOW; m_err_msg += __FUNCTION__; @@ -457,7 +457,7 @@ vtx_t resource_reader_jgf_t::create_vtx (resource_graph_t &g, vtx_t resource_reader_jgf_t::vtx_in_graph (const resource_graph_t &g, const resource_graph_metadata_t &m, - const std::map &paths, int rank) { @@ -528,17 +528,75 @@ int resource_reader_jgf_t::add_graph_metadata (vtx_t v, return rc; } -int resource_reader_jgf_t::update_vmap (std::map remove_edges; + auto iter = m.by_outedges.find (source_vertex); + if (iter == m.by_outedges.end ()) + return rc; + auto &outedges = iter->second; + for (auto kv = outedges.begin (); kv != outedges.end (); ++kv) { + if (boost::target (kv->second, g) == dest_vertex) { + kv = outedges.erase (kv); + // TODO: Consider adding break here + } + } + + rc = 0; + return rc; +} + +int resource_reader_jgf_t::update_vmap (std::map &vmap, - vtx_t v, - const std::map &root_checks, const fetch_helper_t &fetcher) { int rc = -1; std::pair::iterator, bool> ptr; - ptr = vmap.emplace (std::string (fetcher.vertex_id), - vmap_val_t{v, root_checks, + ptr = vmap.emplace (std::string (fetcher.vertex_id), + vmap_val_t{v, root_checks, static_cast (fetcher.size), static_cast (fetcher.exclusive)}); if (!ptr.second) { @@ -776,7 +834,7 @@ int resource_reader_jgf_t::unpack_vertices (resource_graph_t &g, resource_graph_metadata_t &m, std::map &vmap, - json_t *nodes, + json_t *nodes, std::unordered_set &added_vtcs) { @@ -894,7 +952,7 @@ int resource_reader_jgf_t::unpack_edges (resource_graph_t &g, resource_graph_metadata_t &m, std::map &vmap, - json_t *edges, + json_t *edges, const std::unordered_set &added_vtcs) { @@ -914,7 +972,7 @@ int resource_reader_jgf_t::unpack_edges (resource_graph_t &g, if ( (unpack_edge (element, vmap, source, target, &name)) != 0) goto done; // We only add the edge when it connects at least one newly added vertex - if ( (added_vtcs.count (source) == 1) + if ( (added_vtcs.count (source) == 1) || (added_vtcs.count (target) == 1)) { tie (e, inserted) = add_edge (vmap[source].v, vmap[target].v, g); if (inserted == false) { @@ -1053,6 +1111,57 @@ int resource_reader_jgf_t::update_edges (resource_graph_t &g, return rc; } +int resource_reader_jgf_t::get_subgraph_vertices (resource_graph_t &g, + vtx_t vtx, + std::vector &vtx_list) +{ + vtx_t next_vtx; + boost::graph_traits::out_edge_iterator ei, ei_end; + boost::tie (ei, ei_end) = boost::out_edges (vtx, g); + + for (; ei != ei_end; ++ei) { + next_vtx = boost::target (*ei, g); + + for (auto const &paths_it : g[next_vtx].paths) { + // check that we don't recurse on parent edges + if (paths_it.second.find (g[vtx].name) != std::string::npos && + paths_it.second.find (g[vtx].name) < paths_it.second.find (g[next_vtx].name)) { + vtx_list.push_back (next_vtx); + get_subgraph_vertices (g, next_vtx, vtx_list); + break; + } + } + } + + return 0; +} + +int resource_reader_jgf_t::get_parent_vtx (resource_graph_t &g, + vtx_t vtx, + vtx_t &parent_vtx) + +{ + vtx_t next_vtx; + boost::graph_traits::out_edge_iterator ei, ei_end; + boost::tie (ei, ei_end) = boost::out_edges (vtx, g); + int rc = -1; + + for (; ei != ei_end; ++ei) { + next_vtx = boost::target (*ei, g); + for (auto const &paths_it : g[vtx].paths) { + // check that the parent's name exists in the child's path before the child's name + if (paths_it.second.find (g[next_vtx].name) != std::string::npos && + paths_it.second.find (g[vtx].name) > paths_it.second.find (g[next_vtx].name)) { + parent_vtx = next_vtx; + rc = 0; + break; + } + } + } + + return rc; +} + /******************************************************************************** * * @@ -1099,12 +1208,12 @@ int resource_reader_jgf_t::unpack_at (resource_graph_t &g, resource_graph_metadata_t &m, vtx_t &vtx, const std::string &str, int rank) { - /* This functionality is currently experimental, as resource graph - * growth causes a resize of the boost vecS vertex container type. - * Resizing the vecS results in lost job allocations and reservations + /* This functionality is currently experimental, as resource graph + * growth causes a resize of the boost vecS vertex container type. + * Resizing the vecS results in lost job allocations and reservations * as there is no copy constructor for planner. - * vtx_t vtx is not implemented and may be used in the future - * for optimization. + * vtx_t vtx is not implemented and may be used in the future + * for optimization. */ return unpack (g, m, str, rank); @@ -1144,6 +1253,44 @@ int resource_reader_jgf_t::update (resource_graph_t &g, return rc; } +int resource_reader_jgf_t::remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path) +{ + vtx_t subgraph_root_vtx = boost::graph_traits::null_vertex (); + vtx_t parent_vtx = boost::graph_traits::null_vertex (); + std::vector vtx_list; + + auto iter = m.by_path.find (path); + if (iter == m.by_path.end ()) { + return -1; + } + + for (auto &v : iter->second) { + subgraph_root_vtx = v; + } + + vtx_list.push_back (subgraph_root_vtx); + + get_subgraph_vertices (g, subgraph_root_vtx, vtx_list); + + if ( get_parent_vtx (g, subgraph_root_vtx, parent_vtx) ) + return -1; + + if ( remove_metadata_outedges (parent_vtx, subgraph_root_vtx, g, m) ) + return -1; + + for (auto & vtx : vtx_list) + { + // clear vertex edges but don't delete vertex + boost::clear_vertex (vtx, g); + remove_graph_metadata (vtx, g, m); + } + + return 0; + +} + bool resource_reader_jgf_t::is_allowlist_supported () { return false; diff --git a/resource/readers/resource_reader_jgf.hpp b/resource/readers/resource_reader_jgf.hpp index 46cd19d15..c44226c34 100644 --- a/resource/readers/resource_reader_jgf.hpp +++ b/resource/readers/resource_reader_jgf.hpp @@ -74,6 +74,10 @@ class resource_reader_jgf_t : public resource_reader_base_t { const std::string &str, int64_t jobid, int64_t at, uint64_t dur, bool rsv, uint64_t trav_token); + virtual int remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path); + /*! Is the selected reader format support allowlist * * \return false @@ -100,7 +104,13 @@ class resource_reader_jgf_t : public resource_reader_base_t { std::map &is_roots); int add_graph_metadata (vtx_t v, resource_graph_t &g, resource_graph_metadata_t &m); - int update_vmap (std::map &vmap, vtx_t v, + int remove_graph_metadata (vtx_t v, resource_graph_t &g, + resource_graph_metadata_t &m); + int remove_metadata_outedges (vtx_t source_vertex, + vtx_t dest_vertex, + resource_graph_t &g, + resource_graph_metadata_t &m); + int update_vmap (std::map &vmap, vtx_t v, const std::map &root_checks, const fetch_helper_t &fetcher); int add_vtx (resource_graph_t &g, resource_graph_metadata_t &m, @@ -121,19 +131,19 @@ class resource_reader_jgf_t : public resource_reader_base_t { const fetch_helper_t &fetcher, uint64_t jobid, int64_t at, uint64_t dur, bool rsv); int unpack_vertices (resource_graph_t &g, resource_graph_metadata_t &m, - std::map &vmap, + std::map &vmap, json_t *nodes, std::unordered_set &added_vtcs); int undo_vertices (resource_graph_t &g, std::map &vmap, uint64_t jobid, bool rsv); int update_vertices (resource_graph_t &g, resource_graph_metadata_t &m, - std::map &vmap, - json_t *nodes, int64_t jobid, int64_t at, + std::map &vmap, + json_t *nodes, int64_t jobid, int64_t at, uint64_t dur, bool rsv); int update_vertices (resource_graph_t &g, resource_graph_metadata_t &m, - std::map &vmap, - json_t *nodes, int64_t jobid, int64_t at, + std::map &vmap, + json_t *nodes, int64_t jobid, int64_t at, uint64_t dur); int unpack_edge (json_t *element, std::map &vmap, std::string &source, std::string &target, json_t **name); @@ -145,12 +155,18 @@ class resource_reader_jgf_t : public resource_reader_base_t { std::string &source, std::string &target, uint64_t token); int unpack_edges (resource_graph_t &g, resource_graph_metadata_t &m, - std::map &vmap, + std::map &vmap, json_t *edges, const std::unordered_set &added_vtcs); int update_edges (resource_graph_t &g, resource_graph_metadata_t &m, std::map &vmap, json_t *edges, uint64_t token); + int get_subgraph_vertices (resource_graph_t &g, + vtx_t node, + std::vector &node_list); + int get_parent_vtx (resource_graph_t &g, + vtx_t node, + vtx_t &parent_node); }; } // namespace resource_model diff --git a/resource/readers/resource_reader_rv1exec.cpp b/resource/readers/resource_reader_rv1exec.cpp index 507df89b3..8ff14f3dd 100644 --- a/resource/readers/resource_reader_rv1exec.cpp +++ b/resource/readers/resource_reader_rv1exec.cpp @@ -417,7 +417,7 @@ int resource_reader_rv1exec_t::unpack_children (resource_graph_t &g, const char *ids_str = json_string_value (res_ids); if (unpack_child (g, m, parent, res_type, ids_str, rank, pmap) < 0) goto error; - } + } return 0; error: @@ -574,7 +574,7 @@ int resource_reader_rv1exec_t::unpack_internal (resource_graph_t &g, json_t *nodelist = nullptr; json_t *properties = nullptr; struct hostlist *hlist = nullptr; - std::map rmap; + std::map rmap; std::map pmap; if (json_unpack (rv1, "{s:i s:{s:o s:o s?o}}", @@ -672,6 +672,14 @@ int resource_reader_rv1exec_t::unpack_at (resource_graph_t &g, return -1; } +int resource_reader_rv1exec_t::remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path) +{ + errno = ENOTSUP; // RV1Exec reader does not support remove + return -1; +} + int resource_reader_rv1exec_t::update (resource_graph_t &g, resource_graph_metadata_t &m, const std::string &str, int64_t jobid, diff --git a/resource/readers/resource_reader_rv1exec.hpp b/resource/readers/resource_reader_rv1exec.hpp index 932a4c8c0..77445918a 100644 --- a/resource/readers/resource_reader_rv1exec.hpp +++ b/resource/readers/resource_reader_rv1exec.hpp @@ -57,6 +57,10 @@ class resource_reader_rv1exec_t : public resource_reader_base_t { virtual int unpack_at (resource_graph_t &g, resource_graph_metadata_t &m, vtx_t &vtx, const std::string &str, int rank = -1); + virtual int remove_subgraph (resource_graph_t &g, + resource_graph_metadata_t &m, + const std::string &path); + /*! Update resource graph g with str. * * \param g resource graph From 018d0424aa9338f065ce2353c66fa46c9e2f8634 Mon Sep 17 00:00:00 2001 From: Zeke Morton Date: Thu, 20 Jul 2023 15:50:44 -0700 Subject: [PATCH 2/3] resource query: remove subgraph feature Problem: the remove subgraph feature is a part of the readers but does not have functionality in resource query Add support for remove graph in resource query --- resource/utilities/command.cpp | 46 ++++++++++++++++++++++++++++++++-- resource/utilities/command.hpp | 2 ++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/resource/utilities/command.cpp b/resource/utilities/command.cpp index db598db26..45848c58e 100644 --- a/resource/utilities/command.cpp +++ b/resource/utilities/command.cpp @@ -43,6 +43,8 @@ command_t commands[] = { "resource-query> update allocate jgf_file jobid starttime duration" }, { "attach", "j", cmd_attach, "Attach a JGF subgraph to the " "resource graph: resource-query> attach jgf_file" }, + { "remove", "j", cmd_remove, "Experimental: remove a subgraph to the " + "resource graph: resource-query> remove path/to/node/" }, { "find", "f", cmd_find, "Find resources matched with criteria " "(predicates: status={up|down} sched-now={allocated|free} sched-future={reserved|free}): " "resource-query> find status=down and sched-now=allocated" }, @@ -430,14 +432,14 @@ static int attach (std::shared_ptr &ctx, // Unpack_at currently does not use the vertex attachment point. // This functionality is currently experimental. vtx_t v = boost::graph_traits::null_vertex (); - if ( (rd->unpack_at (ctx->db->resource_graph, ctx->db->metadata, + if ( (rd->unpack_at (ctx->db->resource_graph, ctx->db->metadata, v, buffer.str (), -1)) != 0) { std::cerr << "ERROR: can't attach JGF subgraph " << std::endl; std::cerr << "ERROR: " << rd->err_message (); return -1; } if (ctx->traverser->initialize (ctx->fgraph, ctx->db, ctx->matcher) != 0) { - std::cerr << "ERROR: can't reinitialize traverser after attach" + std::cerr << "ERROR: can't reinitialize traverser after attach" << std::endl; return -1; } @@ -445,6 +447,28 @@ static int attach (std::shared_ptr &ctx, return 0; } +static int remove (std::shared_ptr &ctx, + std::vector &args) +{ + const std::string node_path = args[1]; + std::shared_ptr rd; + + if ( (rd = create_resource_reader ("jgf")) == nullptr) { + std::cerr << "ERROR: can't create JGF reader " << std::endl; + return -1; + } + + if ( (rd->remove_subgraph (ctx->db->resource_graph, ctx->db->metadata, + node_path)) != 0) { + std::cerr << "ERROR: can't remove subgraph " << std::endl; + std::cerr << "ERROR: " << rd->err_message (); + return -1; + } + // TODO: reinitialize the traverser, see issue #1075 + + return 0; +} + int cmd_attach (std::shared_ptr &ctx, std::vector &args) { @@ -463,6 +487,24 @@ int cmd_attach (std::shared_ptr &ctx, return 0; } +int cmd_remove (std::shared_ptr &ctx, + std::vector &args) +{ + try { + if (args.size () != 2) { + std::cerr << "ERROR: malformed command" << std::endl; + return 0; + } + remove (ctx, args); + + } catch (std::ifstream::failure &e) { + std::cerr << "ERROR: file I/O exception: " << e.what () << std::endl; + } catch (std::out_of_range &e) { + std::cerr << "ERROR: " << e.what () << std::endl; + } + return 0; +} + int cmd_find (std::shared_ptr &ctx, std::vector &args) { diff --git a/resource/utilities/command.hpp b/resource/utilities/command.hpp index 54b9e9b53..54e139122 100644 --- a/resource/utilities/command.hpp +++ b/resource/utilities/command.hpp @@ -75,6 +75,8 @@ int cmd_update (std::shared_ptr &ctx, std::vector &args); int cmd_attach (std::shared_ptr &ctx, std::vector &args); +int cmd_remove (std::shared_ptr &ctx, + std::vector &args); int cmd_find (std::shared_ptr &ctx, std::vector &args); int cmd_cancel (std::shared_ptr &ctx, From e9c4bfc6a4c3463ac7c8a27e8558a878d8aae7ed Mon Sep 17 00:00:00 2001 From: Zeke Morton Date: Mon, 31 Jul 2023 17:41:44 -0700 Subject: [PATCH 3/3] tests: add tests for remove subgraph problem: the remove subgrapgh feature added new code that needs to be tested as a part of automated ci add tests for this new feature --- t/CMakeLists.txt | 1 + t/Makefile.am | 1 + t/data/resource/commands/remove/cmds01.in | 3 + t/data/resource/commands/remove/cmds02.in | 8 + t/data/resource/commands/remove/cmds03.in | 3 + t/data/resource/commands/remove/cmds04.in | 7 + t/data/resource/commands/remove/cmds05.in | 7 + t/data/resource/commands/remove/cmds06.in | 6 + t/data/resource/expected/remove/001.R.out | 79 +++++ t/data/resource/expected/remove/002.R.out | 97 ++++++ t/data/resource/expected/remove/003.R.out | 103 +++++++ t/data/resource/expected/remove/004.R.out | 360 ++++++++++++++++++++++ t/data/resource/expected/remove/005.R.out | 360 ++++++++++++++++++++++ t/data/resource/expected/remove/006.R.out | 28 ++ t/t3035-resource-remove.t | 66 ++++ 15 files changed, 1129 insertions(+) create mode 100644 t/data/resource/commands/remove/cmds01.in create mode 100644 t/data/resource/commands/remove/cmds02.in create mode 100644 t/data/resource/commands/remove/cmds03.in create mode 100644 t/data/resource/commands/remove/cmds04.in create mode 100644 t/data/resource/commands/remove/cmds05.in create mode 100644 t/data/resource/commands/remove/cmds06.in create mode 100644 t/data/resource/expected/remove/001.R.out create mode 100644 t/data/resource/expected/remove/002.R.out create mode 100644 t/data/resource/expected/remove/003.R.out create mode 100644 t/data/resource/expected/remove/004.R.out create mode 100644 t/data/resource/expected/remove/005.R.out create mode 100644 t/data/resource/expected/remove/006.R.out create mode 100755 t/t3035-resource-remove.t diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt index dbb8559f2..72ed16191 100644 --- a/t/CMakeLists.txt +++ b/t/CMakeLists.txt @@ -61,6 +61,7 @@ set(ALL_TESTS t3031-resource-minmax2.t t3033-resource-nodex.t t3034-resource-pconstraints.t + t3035-resource-remove.t t3300-system-dontblock.t t3301-system-latestart.t t4000-match-params.t diff --git a/t/Makefile.am b/t/Makefile.am index 41489f57e..10b083e02 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -80,6 +80,7 @@ TESTS = \ t3031-resource-minmax2.t \ t3033-resource-nodex.t \ t3034-resource-pconstraints.t \ + t3035-resource-remove.t \ t3300-system-dontblock.t \ t3301-system-latestart.t \ t4000-match-params.t \ diff --git a/t/data/resource/commands/remove/cmds01.in b/t/data/resource/commands/remove/cmds01.in new file mode 100644 index 000000000..a8e47fefc --- /dev/null +++ b/t/data/resource/commands/remove/cmds01.in @@ -0,0 +1,3 @@ +remove /tiny0/rack0/node1/socket1 +find status=up +quit diff --git a/t/data/resource/commands/remove/cmds02.in b/t/data/resource/commands/remove/cmds02.in new file mode 100644 index 000000000..9f182ba1c --- /dev/null +++ b/t/data/resource/commands/remove/cmds02.in @@ -0,0 +1,8 @@ +remove /tiny0/rack0/node1/socket1/core30 +remove /tiny0/rack0/node1/socket1/core31 +remove /tiny0/rack0/node1/socket1/core32 +remove /tiny0/rack0/node1/socket1/core33 +remove /tiny0/rack0/node1/socket1/core34 +remove /tiny0/rack0/node1/socket1/core35 +find status=up +quit diff --git a/t/data/resource/commands/remove/cmds03.in b/t/data/resource/commands/remove/cmds03.in new file mode 100644 index 000000000..99527a757 --- /dev/null +++ b/t/data/resource/commands/remove/cmds03.in @@ -0,0 +1,3 @@ +remove /does/not/exist +find status=up +quit diff --git a/t/data/resource/commands/remove/cmds04.in b/t/data/resource/commands/remove/cmds04.in new file mode 100644 index 000000000..aae1b75c5 --- /dev/null +++ b/t/data/resource/commands/remove/cmds04.in @@ -0,0 +1,7 @@ +find sched-now=free +match allocate @TEST_SRCDIR@/data/resource/jobspecs/elastic/test-ma-node.yaml +find status=up +find sched-now=allocated +remove /tiny0/rack0/node0 +find sched-now=allocated +quit \ No newline at end of file diff --git a/t/data/resource/commands/remove/cmds05.in b/t/data/resource/commands/remove/cmds05.in new file mode 100644 index 000000000..f51ea53cf --- /dev/null +++ b/t/data/resource/commands/remove/cmds05.in @@ -0,0 +1,7 @@ +find sched-now=free +match allocate @TEST_SRCDIR@/data/resource/jobspecs/elastic/test-ma-node.yaml +find status=up +find sched-now=allocated +remove /tiny0/rack0/node1 +find sched-now=allocated +quit \ No newline at end of file diff --git a/t/data/resource/commands/remove/cmds06.in b/t/data/resource/commands/remove/cmds06.in new file mode 100644 index 000000000..34b4e13d8 --- /dev/null +++ b/t/data/resource/commands/remove/cmds06.in @@ -0,0 +1,6 @@ +remove /tiny0/rack0/node1 +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +match allocate @TEST_SRCDIR@/data/resource/jobspecs/basics/test001.yaml +quit \ No newline at end of file diff --git a/t/data/resource/expected/remove/001.R.out b/t/data/resource/expected/remove/001.R.out new file mode 100644 index 000000000..54d2c2cc2 --- /dev/null +++ b/t/data/resource/expected/remove/001.R.out @@ -0,0 +1,79 @@ + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="status=up" +INFO: ============================= diff --git a/t/data/resource/expected/remove/002.R.out b/t/data/resource/expected/remove/002.R.out new file mode 100644 index 000000000..c50d2a94c --- /dev/null +++ b/t/data/resource/expected/remove/002.R.out @@ -0,0 +1,97 @@ + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="status=up" +INFO: ============================= diff --git a/t/data/resource/expected/remove/003.R.out b/t/data/resource/expected/remove/003.R.out new file mode 100644 index 000000000..192cccfd1 --- /dev/null +++ b/t/data/resource/expected/remove/003.R.out @@ -0,0 +1,103 @@ + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="status=up" +INFO: ============================= diff --git a/t/data/resource/expected/remove/004.R.out b/t/data/resource/expected/remove/004.R.out new file mode 100644 index 000000000..55d462c21 --- /dev/null +++ b/t/data/resource/expected/remove/004.R.out @@ -0,0 +1,360 @@ + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=free" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="status=up" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=allocated" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=allocated" +INFO: ============================= diff --git a/t/data/resource/expected/remove/005.R.out b/t/data/resource/expected/remove/005.R.out new file mode 100644 index 000000000..30c667851 --- /dev/null +++ b/t/data/resource/expected/remove/005.R.out @@ -0,0 +1,360 @@ + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=free" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ------------socket1[1:x] + ---------node0[1:x] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node1[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="status=up" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=allocated" +INFO: ============================= + ---------------core0[1:x] + ---------------core1[1:x] + ---------------core2[1:x] + ---------------core3[1:x] + ---------------core4[1:x] + ---------------core5[1:x] + ---------------core6[1:x] + ---------------core7[1:x] + ---------------core8[1:x] + ---------------core9[1:x] + ---------------core10[1:x] + ---------------core11[1:x] + ---------------core12[1:x] + ---------------core13[1:x] + ---------------core14[1:x] + ---------------core15[1:x] + ---------------core16[1:x] + ---------------core17[1:x] + ---------------gpu0[1:x] + ---------------memory0[2:x] + ---------------memory1[2:x] + ---------------memory2[2:x] + ---------------memory3[2:x] + ------------socket0[1:x] + ---------------core18[1:x] + ---------------core19[1:x] + ---------------core20[1:x] + ---------------core21[1:x] + ---------------core22[1:x] + ---------------core23[1:x] + ---------------core24[1:x] + ---------------core25[1:x] + ---------------core26[1:x] + ---------------core27[1:x] + ---------------core28[1:x] + ---------------core29[1:x] + ---------------core30[1:x] + ---------------core31[1:x] + ---------------core32[1:x] + ---------------core33[1:x] + ---------------core34[1:x] + ---------------core35[1:x] + ---------------gpu1[1:x] + ---------------memory4[2:x] + ---------------memory5[2:x] + ---------------memory6[2:x] + ---------------memory7[2:x] + ------------socket1[1:x] + ---------node0[1:x] + ------rack0[1:x] + ---tiny0[1:x] +INFO: ============================= +INFO: EXPRESSION="sched-now=allocated" +INFO: ============================= diff --git a/t/data/resource/expected/remove/006.R.out b/t/data/resource/expected/remove/006.R.out new file mode 100644 index 000000000..38d535549 --- /dev/null +++ b/t/data/resource/expected/remove/006.R.out @@ -0,0 +1,28 @@ + ---------------core0[1:x] + ------------socket0[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=1 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= + ---------------core18[1:x] + ------------socket1[1:x] + ---------node0[1:s] + ------rack0[1:s] + ---tiny0[1:s] +INFO: ============================= +INFO: JOBID=2 +INFO: RESOURCES=ALLOCATED +INFO: SCHEDULED AT=Now +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=3 +INFO: ============================= +INFO: ============================= +INFO: No matching resources found +INFO: JOBID=4 +INFO: ============================= diff --git a/t/t3035-resource-remove.t b/t/t3035-resource-remove.t new file mode 100755 index 000000000..e696a61f2 --- /dev/null +++ b/t/t3035-resource-remove.t @@ -0,0 +1,66 @@ +#!/bin/sh + +test_description='Test resource graph remove subgraph' + +. $(dirname $0)/sharness.sh + +cmd_dir="${SHARNESS_TEST_SRCDIR}/data/resource/commands/remove" +exp_dir="${SHARNESS_TEST_SRCDIR}/data/resource/expected/remove" +jgf="${SHARNESS_TEST_SRCDIR}/data/resource/jgfs/tiny.json" +query="../../resource/utilities/resource-query" + +cmds001="${cmd_dir}/cmds01.in" +test001_desc="remove a single socket" +test_expect_success "${test001_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds001} > cmds001 && + ${query} -L ${jgf} -f jgf -t 001.R.out \ + < cmds001 && + test_cmp 001.R.out ${exp_dir}/001.R.out +' + +cmds002="${cmd_dir}/cmds02.in" +test002_desc="remove several cpus" +test_expect_success "${test002_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds002} > cmds002 && + ${query} -L ${jgf} -f jgf -t 002.R.out \ + < cmds002 && + test_cmp 002.R.out ${exp_dir}/002.R.out +' + +cmds003="${cmd_dir}/cmds03.in" +test003_desc="remove non existent resource" +test_expect_success "${test003_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds003} > cmds003 && + ${query} -L ${jgf} -f jgf -t 003.R.out \ + < cmds003 && + test_cmp 003.R.out ${exp_dir}/003.R.out +' + +cmds004="${cmd_dir}/cmds04.in" +test004_desc="remove resources while allocation exists" +test_expect_success "${test004_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds004} > cmds004 && + ${query} -L ${jgf} -f jgf -t 004.R.out \ + < cmds004 && + test_cmp 004.R.out ${exp_dir}/004.R.out +' + +cmds005="${cmd_dir}/cmds05.in" +test005_desc="remove resources while allocation exists" +test_expect_success "${test005_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds005} > cmds005 && + ${query} -L ${jgf} -f jgf -t 005.R.out -P low \ + < cmds005 && + test_cmp 005.R.out ${exp_dir}/005.R.out +' + +cmds006="${cmd_dir}/cmds06.in" +test006_desc="remove resources then fully allocate remaining graph" +test_expect_success "${test006_desc}" ' + sed "s~@TEST_SRCDIR@~${SHARNESS_TEST_SRCDIR}~g" ${cmds006} > cmds006 && + ${query} -L ${jgf} -f jgf -t 006.R.out -P low \ + < cmds006 && + test_cmp 006.R.out ${exp_dir}/006.R.out +' + +test_done