Skip to content

Commit 4375c43

Browse files
committed
resource: fix decode of rankset="all"
Problem: When Fluxion marks "all" resources down, it uses the size of the by_rank map to encode the set of all ranks, but this is incorrect because excluded ranks are never presented to the scheduler by the flux-core resource module. This can result in down resources being scheduled by Fluxion, causing jobs to immediately fail. Modify decode_all() to use the actual ranks in the by_rank mapping instead of presuming the ranks are 0-(size-1). Fixes #1182
1 parent 17f0ed1 commit 4375c43

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

resource/modules/resource_match.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,14 +1144,10 @@ static int grow_resource_db (std::shared_ptr<resource_ctx_t> &ctx,
11441144
static int decode_all (std::shared_ptr<resource_ctx_t> &ctx,
11451145
std::set<int64_t> &ranks)
11461146
{
1147-
int64_t size = ctx->db->metadata.by_rank.size();
1148-
1149-
for (int64_t rank = 0; rank < size; ++rank) {
1150-
auto ret = ranks.insert (rank);
1151-
if (!ret.second) {
1152-
errno = EEXIST;
1153-
return -1;
1154-
}
1147+
ranks.clear ();
1148+
for (auto const& kv: ctx->db->metadata.by_rank) {
1149+
if (kv.first >= 0)
1150+
ranks.insert (kv.first);
11551151
}
11561152
return 0;
11571153
}

0 commit comments

Comments
 (0)