Skip to content

Commit 98ea2bd

Browse files
authored
Merge pull request #11639 from samuelkgutierrez/session-dir
Conditionally destroy job session directory.
2 parents 42e577f + ffa52ed commit 98ea2bd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ompi/runtime/ompi_rte.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* reserved.
99
* Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved
1010
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
11-
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
11+
* Copyright (c) 2018-2023 Triad National Security, LLC. All rights
1212
* reserved.
1313
* Copyright (c) 2019 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
@@ -62,6 +62,14 @@
6262
opal_process_name_t pmix_name_wildcard = {UINT32_MAX-1, UINT32_MAX-1};
6363
opal_process_name_t pmix_name_invalid = {UINT32_MAX, UINT32_MAX};
6464

65+
/**
66+
* Flag used to indicate whether we setup (and should destroy) our job session
67+
* directory. We keep track of this information because we may be using run-time
68+
* infrastructure that manages its structure (e.g., OpenPMIx). If we setup this
69+
* session directory structure, then we shall cleanup after ourselves.
70+
*/
71+
static bool destroy_job_session_dir = false;
72+
6573
static int _setup_top_session_dir(char **sdir);
6674
static int _setup_job_session_dir(char **sdir);
6775
static int _setup_proc_session_dir(char **sdir);
@@ -974,11 +982,12 @@ int ompi_rte_finalize(void)
974982
{
975983

976984
/* cleanup the session directory we created */
977-
if (NULL != opal_process_info.job_session_dir) {
985+
if (NULL != opal_process_info.job_session_dir && destroy_job_session_dir) {
978986
opal_os_dirpath_destroy(opal_process_info.job_session_dir,
979987
false, check_file);
980988
free(opal_process_info.job_session_dir);
981989
opal_process_info.job_session_dir = NULL;
990+
destroy_job_session_dir = false;
982991
}
983992

984993
if (NULL != opal_process_info.top_session_dir) {
@@ -1176,7 +1185,7 @@ static int _setup_job_session_dir(char **sdir)
11761185
opal_process_info.job_session_dir = NULL;
11771186
return OPAL_ERR_OUT_OF_RESOURCE;
11781187
}
1179-
1188+
destroy_job_session_dir = true;
11801189
return OPAL_SUCCESS;
11811190
}
11821191

0 commit comments

Comments
 (0)