Skip to content

Commit b175907

Browse files
committed
Minor cleanups
If we didn't find any psets when queried about them, that isn't a "not found" error - just return zero for the number and NULL for the list of names. Ensure we remove any pset names once the job containing those names terminates - the pset name doesn't persist beyond the lifetime of the job. Signed-off-by: Ralph Castain <[email protected]>
1 parent 43dce07 commit b175907

File tree

6 files changed

+41
-14
lines changed

6 files changed

+41
-14
lines changed

Diff for: src/mca/state/base/state_base_fns.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2020 IBM Corporation. All rights reserved.
77
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
8-
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
8+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
99
* $COPYRIGHT$
1010
*
1111
* Additional copyrights may follow
@@ -598,6 +598,7 @@ void prte_state_base_check_all_complete(int fd, short args, void *cbdata)
598598
int32_t i32, *i32ptr;
599599
prte_pmix_lock_t lock;
600600
prte_app_context_t *app;
601+
pmix_server_pset_t *pst, *pst2;
601602
PRTE_HIDE_UNUSED_PARAMS(fd, args);
602603

603604
PMIX_ACQUIRE_OBJECT(caddy);
@@ -750,6 +751,13 @@ void prte_state_base_check_all_complete(int fd, short args, void *cbdata)
750751
PMIX_RELEASE(map);
751752
jdata->map = NULL;
752753
}
754+
// if this job has apps that named a pset, then remove them
755+
PMIX_LIST_FOREACH_SAFE(pst, pst2, &prte_pmix_server_globals.psets, pmix_server_pset_t) {
756+
if (pst->jdata == jdata) {
757+
pmix_list_remove_item(&prte_pmix_server_globals.psets, &pst->super);
758+
PMIX_RELEASE(pst);
759+
}
760+
}
753761

754762
CHECK_ALIVE:
755763
/* now check to see if all jobs are done - trigger notification of this jdata

Diff for: src/mca/state/dvm/state_dvm.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* and Technology (RIST). All rights reserved.
55
* Copyright (c) 2020 IBM Corporation. All rights reserved.
66
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
7-
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
7+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
88
* $COPYRIGHT$
99
*
1010
* Additional copyrights may follow
@@ -516,6 +516,7 @@ static void check_complete(int fd, short args, void *cbdata)
516516
hwloc_obj_type_t type;
517517
hwloc_cpuset_t boundcpus, tgt;
518518
bool takeall, sep, *sepptr = &sep;
519+
pmix_server_pset_t *pst, *pst2;
519520
PRTE_HIDE_UNUSED_PARAMS(fd, args);
520521

521522
PMIX_ACQUIRE_OBJECT(caddy);
@@ -812,6 +813,13 @@ static void check_complete(int fd, short args, void *cbdata)
812813
PMIX_RELEASE(map);
813814
jdata->map = NULL;
814815
}
816+
// if this job has apps that named a pset, then remove them
817+
PMIX_LIST_FOREACH_SAFE(pst, pst2, &prte_pmix_server_globals.psets, pmix_server_pset_t) {
818+
if (pst->jdata == jdata) {
819+
pmix_list_remove_item(&prte_pmix_server_globals.psets, &pst->super);
820+
PMIX_RELEASE(pst);
821+
}
822+
}
815823

816824
/* if requested, check fd status for leaks */
817825
if (prte_state_base.run_fdcheck) {

Diff for: src/prted/pmix/pmix_server.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* All rights reserved.
1919
* Copyright (c) 2014-2019 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
21-
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
21+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2222
* Copyright (c) 2023 Triad National Security, LLC. All rights reserved.
2323
* $COPYRIGHT$
2424
*
@@ -2066,6 +2066,7 @@ PMIX_CLASS_INSTANCE(pmix_server_req_t,
20662066
static void pscon(pmix_server_pset_t *p)
20672067
{
20682068
p->name = NULL;
2069+
p->jdata = NULL;
20692070
p->members = NULL;
20702071
p->num_members = 0;
20712072
}
@@ -2074,6 +2075,9 @@ static void psdes(pmix_server_pset_t *p)
20742075
if (NULL != p->name) {
20752076
free(p->name);
20762077
}
2078+
if (NULL != p->jdata) {
2079+
PMIX_RELEASE(p->jdata);
2080+
}
20772081
if (NULL != p->members) {
20782082
free(p->members);
20792083
}

Diff for: src/prted/pmix/pmix_server_internal.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Copyright (c) 2014 Research Organization for Information Science
1919
* and Technology (RIST). All rights reserved.
2020
* Copyright (c) 2020 IBM Corporation. All rights reserved.
21-
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
21+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2222
* $COPYRIGHT$
2323
*
2424
* Additional copyrights may follow
@@ -354,6 +354,7 @@ pmix_server_session_ctrl_fn(const pmix_proc_t *requestor,
354354
typedef struct {
355355
pmix_list_item_t super;
356356
char *name;
357+
prte_job_t *jdata;
357358
pmix_proc_t *members;
358359
size_t num_members;
359360
} pmix_server_pset_t;

Diff for: src/prted/pmix/pmix_server_queries.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Copyright (c) 2014-2019 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* Copyright (c) 2020 IBM Corporation. All rights reserved.
22-
* Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
22+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2323
* Copyright (c) 2024 Triad National Security, LLC. All rights
2424
* reserved.
2525
* $COPYRIGHT$
@@ -319,7 +319,10 @@ static void _query(int sd, short args, void *cbdata)
319319
}
320320
/* add our findings to the results */
321321
PMIX_INFO_LIST_CONVERT(rc, cache, &dry);
322-
if (PMIX_SUCCESS != rc) {
322+
if (PMIX_SUCCESS != rc && PMIX_ERR_EMPTY != rc) {
323+
// if the array is empty, then there is nothing wrong - we
324+
// simply didn't find any runnning jobs
325+
// otherwise, report the error and abort
323326
PMIX_ERROR_LOG(rc);
324327
PMIX_INFO_LIST_RELEASE(cache);
325328
goto done;
@@ -587,18 +590,19 @@ static void _query(int sd, short args, void *cbdata)
587590
PMIX_ARGV_APPEND_NOSIZE_COMPAT(&ans, ps->name);
588591
}
589592
if (NULL == ans) {
590-
ret = PMIX_ERR_NOT_FOUND;
591-
goto done;
593+
tmp = NULL;;
592594
} else {
593595
tmp = PMIX_ARGV_JOIN_COMPAT(ans, ',');
594596
PMIX_ARGV_FREE_COMPAT(ans);
595597
ans = NULL;
596-
PMIX_INFO_LIST_ADD(rc, results, PMIX_QUERY_PSET_NAMES, tmp, PMIX_STRING);
598+
}
599+
PMIX_INFO_LIST_ADD(rc, results, PMIX_QUERY_PSET_NAMES, tmp, PMIX_STRING);
600+
if (NULL != tmp) {
597601
free(tmp);
598-
if (PMIX_SUCCESS != rc) {
599-
PMIX_ERROR_LOG(rc);
600-
goto done;
601-
}
602+
}
603+
if (PMIX_SUCCESS != rc) {
604+
PMIX_ERROR_LOG(rc);
605+
goto done;
602606
}
603607

604608
} else if (0 == strcmp(q->keys[n], PMIX_QUERY_PSET_MEMBERSHIP)) {

Diff for: src/prted/pmix/pmix_server_register_fns.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Copyright (c) 2014-2019 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* Copyright (c) 2017-2020 IBM Corporation. All rights reserved.
22-
* Copyright (c) 2021-2024 Nanook Consulting. All rights reserved.
22+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2323
* Copyright (c) 2024 Triad National Security, LLC. All rights
2424
* reserved.
2525
* $COPYRIGHT$
@@ -402,6 +402,8 @@ int prte_pmix_server_register_nspace(prte_job_t *jdata)
402402
/* register it */
403403
pset = PMIX_NEW(pmix_server_pset_t);
404404
pset->name = strdup(tmp);
405+
PMIX_RETAIN(jdata);
406+
pset->jdata = jdata;
405407
pmix_list_append(&prte_pmix_server_globals.psets, &pset->super);
406408
free(tmp);
407409
/* and its membership */

0 commit comments

Comments
 (0)