Skip to content

Commit

Permalink
Retrieve pset names upon PMIx_Get request
Browse files Browse the repository at this point in the history
Pset memberships are tracked in the server, so
check for such a request and process it there.

Signed-off-by: Ralph Castain <rhc@pmix.org>
  • Loading branch information
rhc54 committed Sep 7, 2023
1 parent 552f5af commit 439c0a0
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/server/pmix_server_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Copyright (c) 2016 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -189,6 +189,8 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_modex_cbfunc_t cbfunc, vo
PMIX_ERROR_LOG(rc);
return rc;
}
PMIX_LOAD_PROCID(&proc, nspace, rank);

/* retrieve any provided info structs */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &cd->ninfo, &cnt, PMIX_SIZE);
Expand Down Expand Up @@ -236,6 +238,35 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_modex_cbfunc_t cbfunc, vo
}
}

/* check for a request for pset names - these are not associated
* with a given nspace. Instead, we are searching for any psets
* that contain the calling process */
if (keyprovided && PMIx_Check_key(key, PMIX_PSET_NAMES)) {
/* loop over all known psets and collect names
* in which this proc is a member */
pmix_pset_t *pset;
char **psets = NULL;
PMIX_LIST_FOREACH(pset, &pmix_server_globals.psets, pmix_pset_t) {
for (n=0; n < pset->nmembers; n++) {
if (PMIx_Check_procid(&pset->members[n], &proc)) {
PMIx_Argv_append_nosize(&psets, pset->name);
break;
}
}
}
if (NULL != psets) {
data = PMIx_Argv_join(psets, ',');
sz = strlen(data);
PMIx_Argv_free(psets);
// pass it back
cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data);
return PMIX_SUCCESS;
} else {
// return not found as this proc doesn't belong to any psets
return PMIX_ERR_NOT_FOUND;
}
}

/* find the nspace object for the target proc */
nptr = NULL;
PMIX_LIST_FOREACH (ns, &pmix_globals.nspaces, pmix_namespace_t) {
Expand Down

0 comments on commit 439c0a0

Please sign in to comment.