Skip to content

Commit a78b9e7

Browse files
committed
orted: fix spawn in singleton mode
in singleton mode, have the spawn'ed orted invoke orte_pre_condition_transports() and send the transport key back to the singleton
1 parent d84ac9b commit a78b9e7

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

orte/mca/ess/singleton/ess_singleton_module.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ static int rte_init(void)
8585
{
8686
int rc, ret;
8787
char *error = NULL;
88-
char *envar, *ev1, *ev2;
89-
uint64_t unique_key[2];
90-
char *string_key;
88+
char *ev1, *ev2;
9189
opal_value_t *kv;
9290
char *val;
9391
int u32, *u32ptr;
@@ -265,19 +263,7 @@ static int rte_init(void)
265263
* we can use the jobfam and stepid as unique keys
266264
* because they are unique values assigned by the RM
267265
*/
268-
if (NULL == getenv(OPAL_MCA_PREFIX"orte_precondition_transports")) {
269-
unique_key[0] = ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid);
270-
unique_key[1] = ORTE_LOCAL_JOBID(ORTE_PROC_MY_NAME->jobid);
271-
if (NULL == (string_key = orte_pre_condition_transports_print(unique_key))) {
272-
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
273-
return ORTE_ERR_OUT_OF_RESOURCE;
274-
}
275-
asprintf(&envar, OPAL_MCA_PREFIX"orte_precondition_transports=%s", string_key);
276-
putenv(envar);
277-
added_transport_keys = true;
278-
/* cannot free the envar as that messes up our environ */
279-
free(string_key);
280-
}
266+
assert (NULL != getenv(OPAL_MCA_PREFIX"orte_precondition_transports"));
281267

282268
/* retrieve our topology */
283269
OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCAL_TOPO,

orte/orted/orted_main.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* et Automatique. All rights reserved.
1818
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
1919
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
20-
* Copyright (c) 2015 Research Organization for Information Science
20+
* Copyright (c) 2015-2016 Research Organization for Information Science
2121
* and Technology (RIST). All rights reserved.
2222
* $COPYRIGHT$
2323
*
@@ -74,6 +74,7 @@
7474
#include "orte/util/nidmap.h"
7575
#include "orte/util/parse_options.h"
7676
#include "orte/mca/rml/base/rml_contact.h"
77+
#include "orte/util/pre_condition_transports.h"
7778

7879
#include "orte/mca/errmgr/errmgr.h"
7980
#include "orte/mca/ess/ess.h"
@@ -526,7 +527,7 @@ int orte_daemon(int argc, char *argv[])
526527
orte_node_t *node;
527528
orte_app_context_t *app;
528529
char *tmp, *nptr, *sysinfo;
529-
char **singenv=NULL;
530+
char **singenv=NULL, *string_key, *env_str;
530531

531532
/* setup the singleton's job */
532533
jdata = OBJ_NEW(orte_job_t);
@@ -587,6 +588,9 @@ int orte_daemon(int argc, char *argv[])
587588
proc->app_idx = 0;
588589
ORTE_FLAG_SET(proc, ORTE_PROC_FLAG_LOCAL);
589590

591+
/* set the ORTE_JOB_TRANSPORT_KEY from the environment */
592+
orte_pre_condition_transports(jdata);
593+
590594
/* register the singleton's nspace with our PMIx server */
591595
if (ORTE_SUCCESS != (ret = orte_pmix_server_register_nspace(jdata))) {
592596
ORTE_ERROR_LOG(ret);
@@ -597,6 +601,16 @@ int orte_daemon(int argc, char *argv[])
597601
ORTE_ERROR_LOG(ret);
598602
goto DONE;
599603
}
604+
605+
/* append the transport key to the envars needed by the singleton */
606+
if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_TRANSPORT_KEY, (void**)&string_key, OPAL_STRING) || NULL == string_key) {
607+
ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND);
608+
goto DONE;
609+
}
610+
asprintf(&env_str, OPAL_MCA_PREFIX"orte_precondition_transports=%s", string_key);
611+
opal_argv_append_nosize(&singenv, env_str);
612+
free(env_str);
613+
600614
nptr = opal_argv_join(singenv, ',');
601615
opal_argv_free(singenv);
602616
/* create a string that contains our uri + sysinfo + PMIx server URI envars */

0 commit comments

Comments
 (0)