Ensure that comm_spawn'd procs get user-specified forwarded envars
Thanks to Tim Miller for reporting the regression from the 1.6 series cmr=v1.7.4:reviewer=jsquyres:subject=Ensure that comm_spawn'd procs get user-specified forwarded envars This commit was SVN r30012.
This commit is contained in:
parent
7cf0fc5578
commit
71b52fe861
@ -131,6 +131,8 @@ void orte_plm_base_recv(int status, orte_process_name_t* sender,
|
||||
pid_t pid;
|
||||
bool running;
|
||||
int8_t flag;
|
||||
int i;
|
||||
char **env;
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output,
|
||||
"%s plm:base:receive processing msg",
|
||||
@ -178,7 +180,21 @@ void orte_plm_base_recv(int status, orte_process_name_t* sender,
|
||||
NULL == child_app->prefix_dir) {
|
||||
child_app->prefix_dir = strdup(app->prefix_dir);
|
||||
}
|
||||
|
||||
|
||||
/* if the user asked to forward any envars, cycle through the app contexts
|
||||
* in the comm_spawn request and add them
|
||||
*/
|
||||
if (NULL != orte_forwarded_envars) {
|
||||
for (i=0; i < jdata->apps->size; i++) {
|
||||
if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, i))) {
|
||||
continue;
|
||||
}
|
||||
env = opal_environ_merge(orte_forwarded_envars, app->env);
|
||||
opal_argv_free(app->env);
|
||||
app->env = env;
|
||||
}
|
||||
}
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output,
|
||||
"%s plm:base:receive adding hosts",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
||||
|
@ -180,6 +180,7 @@ int orte_stat_history_size;
|
||||
|
||||
/* envars to forward */
|
||||
char *orte_forward_envars = NULL;
|
||||
char **orte_forwarded_envars = NULL;
|
||||
|
||||
/* map-reduce mode */
|
||||
bool orte_map_reduce = false;
|
||||
|
@ -718,6 +718,7 @@ ORTE_DECLSPEC extern int orte_stat_history_size;
|
||||
|
||||
/* envars to forward */
|
||||
ORTE_DECLSPEC extern char *orte_forward_envars;
|
||||
ORTE_DECLSPEC extern char **orte_forwarded_envars;
|
||||
|
||||
/* map-reduce mode */
|
||||
ORTE_DECLSPEC extern bool orte_map_reduce;
|
||||
|
@ -1680,14 +1680,20 @@ static int create_app(int argc, char* argv[],
|
||||
|
||||
if (NULL != strchr(param, '=')) {
|
||||
opal_argv_append_nosize(&app->env, param);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, param);
|
||||
} else {
|
||||
value = getenv(param);
|
||||
if (NULL != value) {
|
||||
if (NULL != strchr(value, '=')) {
|
||||
opal_argv_append_nosize(&app->env, value);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, value);
|
||||
} else {
|
||||
asprintf(&value2, "%s=%s", param, value);
|
||||
opal_argv_append_nosize(&app->env, value2);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, value2);
|
||||
free(value2);
|
||||
}
|
||||
} else {
|
||||
@ -1705,15 +1711,21 @@ static int create_app(int argc, char* argv[],
|
||||
if (NULL != strchr(vars[i], '=')) {
|
||||
/* user supplied a value */
|
||||
opal_argv_append_nosize(&app->env, vars[i]);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, vars[i]);
|
||||
} else {
|
||||
/* get the value from the environ */
|
||||
value = getenv(vars[i]);
|
||||
if (NULL != value) {
|
||||
if (NULL != strchr(value, '=')) {
|
||||
opal_argv_append_nosize(&app->env, value);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, value);
|
||||
} else {
|
||||
asprintf(&value2, "%s=%s", vars[i], value);
|
||||
opal_argv_append_nosize(&app->env, value2);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, value2);
|
||||
free(value2);
|
||||
}
|
||||
} else {
|
||||
@ -1729,6 +1741,8 @@ static int create_app(int argc, char* argv[],
|
||||
if (NULL != orterun_globals.path) {
|
||||
asprintf(&value, "OMPI_exec_path=%s", orterun_globals.path);
|
||||
opal_argv_append_nosize(&app->env, value);
|
||||
/* save it for any comm_spawn'd apps */
|
||||
opal_argv_append_nosize(&orte_forwarded_envars, value);
|
||||
free(value);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user