Skip to content

Commit dee2d86

Browse files
author
Ralph Castain
committed
Fix plm/rsh runtime check
Fix the check for rsh/ssh so we allow the check for SGE and LoadLeveler to occur if user doesn't specify their own launch agent. Fix a Coverity warning Signed-off-by: Ralph Castain <[email protected]>
1 parent 81e57bb commit dee2d86

File tree

2 files changed

+47
-38
lines changed

2 files changed

+47
-38
lines changed

orte/mca/plm/rsh/plm_rsh_component.c

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -270,47 +270,54 @@ static int rsh_component_query(mca_base_module_t **module, int *priority)
270270
return ret;
271271
}
272272
if (MCA_BASE_VAR_SOURCE_DEFAULT != source) {
273-
if (!mca_plm_rsh_component.disable_qrsh &&
274-
NULL != getenv("SGE_ROOT") && NULL != getenv("ARC") &&
275-
NULL != getenv("PE_HOSTFILE") && NULL != getenv("JOB_ID")) {
276-
/* setup the search path for qrsh */
277-
asprintf(&tmp, "%s/bin/%s", getenv("SGE_ROOT"), getenv("ARC"));
278-
/* see if the agent is available */
279-
if (ORTE_SUCCESS != rsh_launch_agent_lookup("qrsh", tmp)) {
280-
/* can't be SGE */
281-
opal_output_verbose(1, orte_plm_base_framework.framework_output,
282-
"%s plm:rsh: unable to be used: SGE indicated but cannot find path "
283-
"or execution permissions not set for launching agent qrsh",
284-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
285-
free(tmp);
286-
*module = NULL;
287-
return ORTE_ERROR;
288-
}
289-
mca_plm_rsh_component.agent = tmp;
290-
mca_plm_rsh_component.using_qrsh = true;
291-
goto success;
292-
} else if (!mca_plm_rsh_component.disable_llspawn &&
293-
NULL != getenv("LOADL_STEP_ID")) {
294-
/* We are running as a LOADLEVELER job.
295-
* Search for llspawn in the users PATH */
296-
if (ORTE_SUCCESS != rsh_launch_agent_lookup("llspawn", NULL)) {
297-
opal_output_verbose(1, orte_plm_base_framework.framework_output,
298-
"%s plm:rsh: unable to be used: LoadLeveler "
299-
"indicated but cannot find path or execution "
300-
"permissions not set for launching agent llspawn",
301-
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
302-
*module = NULL;
303-
return ORTE_ERROR;
304-
}
305-
mca_plm_rsh_component.agent = strdup("llspawn");
306-
mca_plm_rsh_component.using_llspawn = true;
307-
goto success;
273+
/* if the user specified a launch agent, then
274+
* respect that request */
275+
goto lookup;
276+
}
277+
278+
/* check for SGE */
279+
if (!mca_plm_rsh_component.disable_qrsh &&
280+
NULL != getenv("SGE_ROOT") && NULL != getenv("ARC") &&
281+
NULL != getenv("PE_HOSTFILE") && NULL != getenv("JOB_ID")) {
282+
/* setup the search path for qrsh */
283+
asprintf(&tmp, "%s/bin/%s", getenv("SGE_ROOT"), getenv("ARC"));
284+
/* see if the agent is available */
285+
if (ORTE_SUCCESS != rsh_launch_agent_lookup("qrsh", tmp)) {
286+
/* can't be SGE */
287+
opal_output_verbose(1, orte_plm_base_framework.framework_output,
288+
"%s plm:rsh: unable to be used: SGE indicated but cannot find path "
289+
"or execution permissions not set for launching agent qrsh",
290+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
291+
free(tmp);
292+
*module = NULL;
293+
return ORTE_ERROR;
308294
}
295+
mca_plm_rsh_component.agent = tmp;
296+
mca_plm_rsh_component.using_qrsh = true;
297+
goto success;
298+
}
299+
300+
/* otherwise, check for LoadLeveler */
301+
if (!mca_plm_rsh_component.disable_llspawn &&
302+
NULL != getenv("LOADL_STEP_ID")) {
303+
/* Search for llspawn in the users PATH */
304+
if (ORTE_SUCCESS != rsh_launch_agent_lookup("llspawn", NULL)) {
305+
opal_output_verbose(1, orte_plm_base_framework.framework_output,
306+
"%s plm:rsh: unable to be used: LoadLeveler "
307+
"indicated but cannot find path or execution "
308+
"permissions not set for launching agent llspawn",
309+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
310+
*module = NULL;
311+
return ORTE_ERROR;
312+
}
313+
mca_plm_rsh_component.agent = strdup("llspawn");
314+
mca_plm_rsh_component.using_llspawn = true;
315+
goto success;
309316
}
310317

311318
/* if this isn't an Grid Engine or LoadLeveler environment, or
312319
* if the user specified a launch agent, look for it */
313-
320+
lookup:
314321
if (ORTE_SUCCESS != rsh_launch_agent_lookup(NULL, NULL)) {
315322
/* if the user specified an agent and we couldn't find it,
316323
* then we want to error out and not continue */
@@ -329,7 +336,8 @@ static int rsh_component_query(mca_base_module_t **module, int *priority)
329336
*module = NULL;
330337
return ORTE_ERROR;
331338
}
332-
success:
339+
340+
success:
333341
/* we are good - make ourselves available */
334342
*priority = mca_plm_rsh_component.priority;
335343
*module = (mca_base_module_t *) &orte_plm_rsh_module;

orte/mca/plm/rsh/plm_rsh_module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,8 @@ static void launch_daemons(int fd, short args, void *cbdata)
11651165
}
11661166
}
11671167
/* we need mpirun to be the first node on this list */
1168-
if (0 != strcmp(nodelist[0], orte_process_info.nodename)) {
1168+
if (NULL == nodelist ||
1169+
0 != strcmp(nodelist[0], orte_process_info.nodename)) {
11691170
opal_argv_prepend_nosize(&nodelist, orte_process_info.nodename);
11701171
}
11711172
nlistflat = opal_argv_join(nodelist, ',');

0 commit comments

Comments
 (0)