diff --git a/orte/mca/ess/base/ess_base_put.c b/orte/mca/ess/base/ess_base_put.c index 98386d0e24..d77dbaad1f 100644 --- a/orte/mca/ess/base/ess_base_put.c +++ b/orte/mca/ess/base/ess_base_put.c @@ -39,12 +39,14 @@ int orte_ess_env_put(orte_std_cntr_t num_procs, char* param; char* value; - /* tell the ESS to select the env component */ + /* tell the ESS to select the env component - but don't override + * anything that may have been provided elsewhere + */ if(NULL == (param = mca_base_param_environ_variable("ess",NULL,NULL))) { ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); return ORTE_ERR_OUT_OF_RESOURCE; } - opal_setenv(param, "env", true, env); + opal_setenv(param, "env", false, env); free(param); /* since we want to pass the name as separate components, make sure diff --git a/orte/mca/ess/cm/ess_cm_module.c b/orte/mca/ess/cm/ess_cm_module.c index 8b3504ee26..1c9604e994 100644 --- a/orte/mca/ess/cm/ess_cm_module.c +++ b/orte/mca/ess/cm/ess_cm_module.c @@ -196,6 +196,38 @@ static int rte_init(void) } opal_argv_free(hosts); } else if (ORTE_PROC_IS_TOOL) { + /* if we were given a jobid, use it */ + mca_base_param_reg_string_name("orte", "ess_jobid", "Process jobid", + true, false, NULL, &tmp); + if (NULL != tmp) { + if (ORTE_SUCCESS != (ret = orte_util_convert_string_to_jobid(&jobid, tmp))) { + ORTE_ERROR_LOG(ret); + error = "convert_jobid"; + goto error; + } + free(tmp); + ORTE_PROC_MY_NAME->jobid = jobid; + } + + /* if we were given a vpid, use it */ + mca_base_param_reg_string_name("orte", "ess_vpid", "Process vpid", + true, false, NULL, &tmp); + if (NULL != tmp) { + if (ORTE_SUCCESS != (ret = orte_util_convert_string_to_vpid(&vpid, tmp))) { + ORTE_ERROR_LOG(ret); + error = "convert_vpid"; + goto error; + } + free(tmp); + ORTE_PROC_MY_NAME->vpid = vpid; + } + + /* if both were given, then we are done */ + if (ORTE_JOBID_INVALID != jobid && + ORTE_VPID_INVALID != vpid) { + goto tool_done; + } + /* create our own name */ if (ORTE_SUCCESS != (ret = orte_plm_base_open())) { ORTE_ERROR_LOG(ret); @@ -218,6 +250,7 @@ static int rte_init(void) */ orte_plm_base_close(); + tool_done: /* do the rest of the standard tool init */ if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) { ORTE_ERROR_LOG(ret); diff --git a/orte/orted/orted_main.c b/orte/orted/orted_main.c index fc268bd48d..c36fb8fb55 100644 --- a/orte/orted/orted_main.c +++ b/orte/orted/orted_main.c @@ -301,6 +301,8 @@ int orte_daemon(int argc, char *argv[]) */ orte_launch_environ = opal_argv_copy(environ); + /* purge any ess flag set in the environ when we were launched */ + opal_unsetenv("OMPI_MCA_ess", &orte_launch_environ); /* if orte_daemon_debug is set, let someone know we are alive right * away just in case we have a problem along the way diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index bb62b62943..682c3b9a7e 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -555,6 +555,9 @@ int orterun(int argc, char *argv[]) */ orte_launch_environ = opal_argv_copy(environ); + /* purge an ess flag set externally */ + opal_unsetenv("OMPI_MCA_ess", &orte_launch_environ); + #if OPAL_ENABLE_FT_CR == 1 /* Disable OPAL CR notifications for this tool */ opal_cr_set_enabled(false);