Skip to content

Commit 6dd718a

Browse files
author
Ralph Castain
authored
Merge pull request #4325 from rhc54/topic/event
Add support for the -v (verbose) option to prun and silence the "executing" and "completed" output otherwise.
2 parents 1ae78e2 + 388034c commit 6dd718a

File tree

4 files changed

+106
-18
lines changed

4 files changed

+106
-18
lines changed

opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,9 @@ static void _notify_client_event(int sd, short args, void *cbdata)
815815
/* check for caching instructions */
816816
for (n=0; n < cd->ninfo; n++) {
817817
if (0 == strncmp(cd->info[n].key, PMIX_EVENT_DO_NOT_CACHE, PMIX_MAX_KEYLEN)) {
818-
holdcd = PMIX_INFO_TRUE(&cd->info[n]);
818+
if (PMIX_INFO_TRUE(&cd->info[n])) {
819+
holdcd = false;
820+
}
819821
break;
820822
}
821823
}

opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err)
140140
}
141141
}
142142
}
143-
if (!peer->finalized) {
143+
if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer)) {
144144
/* if this peer already called finalize, then
145145
* we are just seeing their connection go away
146146
* when they terminate - so do not generate

orte/mca/state/dvm/state_dvm.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -599,19 +599,18 @@ static void dvm_notify(int sd, short args, void *cbdata)
599599
val->type = OPAL_STATUS;
600600
val->data.status = ret;
601601
opal_list_append(info, &val->super);
602-
/* if there was a problem, we need to send the requestor more info about what happened */
603-
if (ORTE_SUCCESS != ret) {
604-
val = OBJ_NEW(opal_value_t);
605-
val->key = strdup(OPAL_PMIX_PROCID);
606-
val->type = OPAL_NAME;
607-
val->data.name.jobid = jdata->jobid;
608-
if (NULL != pptr) {
609-
val->data.name.vpid = pptr->name.vpid;
610-
} else {
611-
val->data.name.vpid = ORTE_VPID_WILDCARD;
612-
}
613-
opal_list_append(info, &val->super);
602+
/* tell the requestor which job or proc */
603+
val = OBJ_NEW(opal_value_t);
604+
val->key = strdup(OPAL_PMIX_PROCID);
605+
val->type = OPAL_NAME;
606+
val->data.name.jobid = jdata->jobid;
607+
if (NULL != pptr) {
608+
val->data.name.vpid = pptr->name.vpid;
609+
} else {
610+
val->data.name.vpid = ORTE_VPID_WILDCARD;
614611
}
612+
opal_list_append(info, &val->super);
613+
/* setup the caddy */
615614
mycaddy = (mycaddy_t*)malloc(sizeof(mycaddy_t));
616615
mycaddy->info = info;
617616
OBJ_RETAIN(jdata);

orte/tools/prun/prun.c

Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,19 @@ static void evhandler(int status,
174174
void *cbdata)
175175
{
176176
opal_value_t *val;
177+
int jobstatus=0;
178+
orte_jobid_t jobid = ORTE_JOBID_INVALID;
177179

178-
if (NULL != info) {
180+
if (orte_cmd_options.verbose && NULL != info) {
179181
OPAL_LIST_FOREACH(val, info, opal_value_t) {
180182
if (0 == strcmp(val->key, OPAL_PMIX_JOB_TERM_STATUS)) {
181-
opal_output(0, "JOB COMPLETED WITH STATUS %d",
182-
val->data.integer);
183+
jobstatus = val->data.integer;
184+
} else if (0 == strcmp(val->key, OPAL_PMIX_PROCID)) {
185+
jobid = val->data.name.jobid;
183186
}
184187
}
188+
opal_output(0, "JOB %s COMPLETED WITH STATUS %d",
189+
ORTE_JOBID_PRINT(jobid), jobstatus);
185190
}
186191
if (NULL != cbfunc) {
187192
cbfunc(OPAL_SUCCESS, NULL, NULL, NULL, cbdata);
@@ -622,7 +627,9 @@ int prun(int argc, char *argv[])
622627
OPAL_LIST_DESTRUCT(&job_info);
623628
OPAL_LIST_DESTRUCT(&apps);
624629

625-
opal_output(0, "JOB %s EXECUTING", OPAL_JOBID_PRINT(jobid));
630+
if (orte_cmd_options.verbose) {
631+
opal_output(0, "JOB %s EXECUTING", OPAL_JOBID_PRINT(jobid));
632+
}
626633

627634
while (active) {
628635
nanosleep(&tp, NULL);
@@ -788,6 +795,86 @@ static int create_app(int argc, char* argv[],
788795
}
789796
}
790797

798+
/* set necessary env variables for external usage from tune conf file*/
799+
int set_from_file = 0;
800+
char **vars = NULL;
801+
if (OPAL_SUCCESS == mca_base_var_process_env_list_from_file(&vars) &&
802+
NULL != vars) {
803+
for (i=0; NULL != vars[i]; i++) {
804+
value = strchr(vars[i], '=');
805+
/* terminate the name of the param */
806+
*value = '\0';
807+
/* step over the equals */
808+
value++;
809+
/* overwrite any prior entry */
810+
opal_setenv(vars[i], value, true, &app->env);
811+
/* save it for any comm_spawn'd apps */
812+
opal_setenv(vars[i], value, true, &orte_forwarded_envars);
813+
}
814+
set_from_file = 1;
815+
opal_argv_free(vars);
816+
}
817+
/* Did the user request to export any environment variables on the cmd line? */
818+
char *env_set_flag;
819+
env_set_flag = getenv("OMPI_MCA_mca_base_env_list");
820+
if (opal_cmd_line_is_taken(orte_cmd_line, "x")) {
821+
if (NULL != env_set_flag) {
822+
opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false);
823+
return ORTE_ERR_FATAL;
824+
}
825+
j = opal_cmd_line_get_ninsts(orte_cmd_line, "x");
826+
for (i = 0; i < j; ++i) {
827+
param = opal_cmd_line_get_param(orte_cmd_line, "x", i, 0);
828+
829+
if (NULL != (value = strchr(param, '='))) {
830+
/* terminate the name of the param */
831+
*value = '\0';
832+
/* step over the equals */
833+
value++;
834+
/* overwrite any prior entry */
835+
opal_setenv(param, value, true, &app->env);
836+
/* save it for any comm_spawn'd apps */
837+
opal_setenv(param, value, true, &orte_forwarded_envars);
838+
} else {
839+
value = getenv(param);
840+
if (NULL != value) {
841+
/* overwrite any prior entry */
842+
opal_setenv(param, value, true, &app->env);
843+
/* save it for any comm_spawn'd apps */
844+
opal_setenv(param, value, true, &orte_forwarded_envars);
845+
} else {
846+
opal_output(0, "Warning: could not find environment variable \"%s\"\n", param);
847+
}
848+
}
849+
}
850+
} else if (NULL != env_set_flag) {
851+
/* if mca_base_env_list was set, check if some of env vars were set via -x from a conf file.
852+
* If this is the case, error out.
853+
*/
854+
if (!set_from_file) {
855+
/* set necessary env variables for external usage */
856+
vars = NULL;
857+
if (OPAL_SUCCESS == mca_base_var_process_env_list(env_set_flag, &vars) &&
858+
NULL != vars) {
859+
for (i=0; NULL != vars[i]; i++) {
860+
value = strchr(vars[i], '=');
861+
/* terminate the name of the param */
862+
*value = '\0';
863+
/* step over the equals */
864+
value++;
865+
/* overwrite any prior entry */
866+
opal_setenv(vars[i], value, true, &app->env);
867+
/* save it for any comm_spawn'd apps */
868+
opal_setenv(vars[i], value, true, &orte_forwarded_envars);
869+
}
870+
opal_argv_free(vars);
871+
}
872+
} else {
873+
opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false);
874+
return ORTE_ERR_FATAL;
875+
}
876+
}
877+
791878
/* Did the user request a specific wdir? */
792879

793880
if (NULL != orte_cmd_options.wdir) {

0 commit comments

Comments
 (0)