Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traverser: allow non-exclusive slots #1194

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions resource/traversers/dfu_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ bool dfu_impl_t::slot_match (vtx_t u, const Resource *slot_resources)
const std::vector<Resource> &dfu_impl_t::test (vtx_t u,
const std::vector<Resource> &resources,
bool &pristine, unsigned int &nslots,
match_kind_t &spec)
match_kind_t &spec, bool *excl)
{
/* Note on the purpose of pristine: we differentiate two similar but
* distinct cases with this parameter.
Expand Down Expand Up @@ -338,6 +338,11 @@ const std::vector<Resource> &dfu_impl_t::test (vtx_t u,
spec = match_kind_t::SLOT_MATCH;
pristine = false;
ret = &(slot_resources->with);
// everything under slot is exclusive unless explicitly
// requested other with 'exclusive: false'
if (*excl || slot_resources->exclusive != Jobspec::tristate_t::FALSE) {
*excl = true;
}
} else if (match_resources) {
spec = match_kind_t::RESOURCE_MATCH;
pristine = false;
Expand Down Expand Up @@ -631,7 +636,7 @@ int dfu_impl_t::dom_slot (const jobmeta_t &meta, vtx_t u,
bool pristine, bool *excl, scoring_api_t &dfu)
{
int rc;
bool x_inout = true;
bool x_inout = *excl;
scoring_api_t dfu_slot;
unsigned int qual_num_slots = 0;
std::vector<eval_egroup_t> edg_group_vector;
Expand Down Expand Up @@ -662,7 +667,7 @@ int dfu_impl_t::dom_slot (const jobmeta_t &meta, vtx_t u,
goto done;
}
eval_edg_t ev_edg ((*egroup_i).edges[0].count,
(*egroup_i).edges[0].count, 1,
(*egroup_i).edges[0].count, x_inout,
(*egroup_i).edges[0].edge);
score += (*egroup_i).score;
edg_group.edges.push_back (ev_edg);
Expand All @@ -671,7 +676,7 @@ int dfu_impl_t::dom_slot (const jobmeta_t &meta, vtx_t u,
}
edg_group.score = score;
edg_group.count = 1;
edg_group.exclusive = 1;
edg_group.exclusive = x_inout;
edg_group_vector.push_back (edg_group);
}
for (auto &edg_group : edg_group_vector)
Expand All @@ -697,7 +702,7 @@ int dfu_impl_t::dom_dfv (const jobmeta_t &meta, vtx_t u,
planner_t *p = NULL;
const std::string &dom = m_match->dom_subsystem ();
const std::vector<Resource> &next = test (u, resources,
check_pres, nslots, sm);
check_pres, nslots, sm, &x_inout);

m_preorder++;
if (sm == match_kind_t::NONE_MATCH)
Expand Down
2 changes: 1 addition & 1 deletion resource/traversers/dfu_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class dfu_impl_t {
bool slot_match (vtx_t u, const Jobspec::Resource *slot_resource);
const std::vector<Jobspec::Resource> &test (vtx_t u,
const std::vector<Jobspec::Resource> &resources,
bool &prestine, unsigned int &nslots, match_kind_t &ko);
bool &prestine, unsigned int &nslots, match_kind_t &ko, bool *excl);
bool is_pconstraint_matched (vtx_t u, const std::string &property);


Expand Down
Loading