16
16
* Copyright (c) 2019 Research Organization for Information Science
17
17
* and Technology (RIST). All rights reserved.
18
18
* Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
19
- * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
19
+ * Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
20
20
* $COPYRIGHT$
21
21
*
22
22
* Additional copyrights may follow
@@ -84,17 +84,26 @@ prte_mca_plm_slurm_component_t prte_mca_plm_slurm_component = {
84
84
here; will be initialized in plm_slurm_open() */
85
85
};
86
86
87
+ static char * custom_args = NULL ;
88
+ static char * force_args = NULL ;
89
+
87
90
static int plm_slurm_register (void )
88
91
{
89
92
pmix_mca_base_component_t * comp = & prte_mca_plm_slurm_component .super ;
90
93
91
- prte_mca_plm_slurm_component .custom_args = NULL ;
92
- (void ) pmix_mca_base_component_var_register (comp , "args" , "Custom arguments to srun" ,
94
+
95
+ prte_mca_plm_slurm_component .custom_args_index =
96
+ pmix_mca_base_component_var_register (comp , "args" , "Custom arguments to srun" ,
97
+ PMIX_MCA_BASE_VAR_TYPE_STRING ,
98
+ & custom_args );
99
+
100
+ force_args = NULL ;
101
+ (void ) pmix_mca_base_component_var_register (comp , "force_args" , "Mandatory custom arguments to srun" ,
93
102
PMIX_MCA_BASE_VAR_TYPE_STRING ,
94
- & prte_mca_plm_slurm_component . custom_args );
103
+ & force_args );
95
104
96
- prte_mca_plm_slurm_component .slurm_warning_msg = true ;
97
- (void ) pmix_mca_base_component_var_register (comp , "warning " , "Turn off warning message" ,
105
+ prte_mca_plm_slurm_component .slurm_warning_msg = false ;
106
+ (void ) pmix_mca_base_component_var_register (comp , "disable_warning " , "Turn off warning message about custom args set in environment " ,
98
107
PMIX_MCA_BASE_VAR_TYPE_BOOL ,
99
108
& prte_mca_plm_slurm_component .slurm_warning_msg );
100
109
@@ -108,6 +117,9 @@ static int plm_slurm_open(void)
108
117
109
118
static int prte_mca_plm_slurm_component_query (pmix_mca_base_module_t * * module , int * priority )
110
119
{
120
+ const pmix_mca_base_var_t * var ;
121
+ pmix_status_t rc ;
122
+
111
123
/* Are we running under a SLURM job? */
112
124
113
125
if (NULL != getenv ("SLURM_JOBID" )) {
@@ -117,6 +129,30 @@ static int prte_mca_plm_slurm_component_query(pmix_mca_base_module_t **module, i
117
129
"%s plm:slurm: available for selection" ,
118
130
PRTE_NAME_PRINT (PRTE_PROC_MY_NAME )));
119
131
132
+ prte_mca_plm_slurm_component .custom_args = NULL ;
133
+
134
+ // if we were are warning about externally set custom args, then
135
+ // check to see if that was done
136
+ if (!prte_mca_plm_slurm_component .slurm_warning_msg &&
137
+ NULL == force_args ) {
138
+ // check for custom args
139
+ rc = pmix_mca_base_var_get (prte_mca_plm_slurm_component .custom_args_index , & var );
140
+ if (PMIX_SUCCESS == rc ) {
141
+ // the variable was set - see who set it
142
+ if (PMIX_MCA_BASE_VAR_SOURCE_ENV == var -> mbv_source ) {
143
+ // set in the environment - warn
144
+ pmix_show_help ("help-plm-slurm.txt" , "custom-args-in-env" , true,
145
+ custom_args );
146
+ }
147
+ }
148
+ }
149
+
150
+ if (NULL != force_args ) {
151
+ prte_mca_plm_slurm_component .custom_args = force_args ;
152
+ } else if (NULL != custom_args ) {
153
+ prte_mca_plm_slurm_component .custom_args = custom_args ;
154
+ }
155
+
120
156
* module = (pmix_mca_base_module_t * ) & prte_plm_slurm_module ;
121
157
return PRTE_SUCCESS ;
122
158
}
0 commit comments