Skip to content

Add support for the -v (verbose) option to prun and silence the "executing" and "completed" output otherwise. #4325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,9 @@ static void _notify_client_event(int sd, short args, void *cbdata)
/* check for caching instructions */
for (n=0; n < cd->ninfo; n++) {
if (0 == strncmp(cd->info[n].key, PMIX_EVENT_DO_NOT_CACHE, PMIX_MAX_KEYLEN)) {
holdcd = PMIX_INFO_TRUE(&cd->info[n]);
if (PMIX_INFO_TRUE(&cd->info[n])) {
holdcd = false;
}
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err)
}
}
}
if (!peer->finalized) {
if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer)) {
/* if this peer already called finalize, then
* we are just seeing their connection go away
* when they terminate - so do not generate
Expand Down
23 changes: 11 additions & 12 deletions orte/mca/state/dvm/state_dvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,19 +599,18 @@ static void dvm_notify(int sd, short args, void *cbdata)
val->type = OPAL_STATUS;
val->data.status = ret;
opal_list_append(info, &val->super);
/* if there was a problem, we need to send the requestor more info about what happened */
if (ORTE_SUCCESS != ret) {
val = OBJ_NEW(opal_value_t);
val->key = strdup(OPAL_PMIX_PROCID);
val->type = OPAL_NAME;
val->data.name.jobid = jdata->jobid;
if (NULL != pptr) {
val->data.name.vpid = pptr->name.vpid;
} else {
val->data.name.vpid = ORTE_VPID_WILDCARD;
}
opal_list_append(info, &val->super);
/* tell the requestor which job or proc */
val = OBJ_NEW(opal_value_t);
val->key = strdup(OPAL_PMIX_PROCID);
val->type = OPAL_NAME;
val->data.name.jobid = jdata->jobid;
if (NULL != pptr) {
val->data.name.vpid = pptr->name.vpid;
} else {
val->data.name.vpid = ORTE_VPID_WILDCARD;
}
opal_list_append(info, &val->super);
/* setup the caddy */
mycaddy = (mycaddy_t*)malloc(sizeof(mycaddy_t));
mycaddy->info = info;
OBJ_RETAIN(jdata);
Expand Down
95 changes: 91 additions & 4 deletions orte/tools/prun/prun.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,19 @@ static void evhandler(int status,
void *cbdata)
{
opal_value_t *val;
int jobstatus=0;
orte_jobid_t jobid = ORTE_JOBID_INVALID;

if (NULL != info) {
if (orte_cmd_options.verbose && NULL != info) {
OPAL_LIST_FOREACH(val, info, opal_value_t) {
if (0 == strcmp(val->key, OPAL_PMIX_JOB_TERM_STATUS)) {
opal_output(0, "JOB COMPLETED WITH STATUS %d",
val->data.integer);
jobstatus = val->data.integer;
} else if (0 == strcmp(val->key, OPAL_PMIX_PROCID)) {
jobid = val->data.name.jobid;
}
}
opal_output(0, "JOB %s COMPLETED WITH STATUS %d",
ORTE_JOBID_PRINT(jobid), jobstatus);
}
if (NULL != cbfunc) {
cbfunc(OPAL_SUCCESS, NULL, NULL, NULL, cbdata);
Expand Down Expand Up @@ -622,7 +627,9 @@ int prun(int argc, char *argv[])
OPAL_LIST_DESTRUCT(&job_info);
OPAL_LIST_DESTRUCT(&apps);

opal_output(0, "JOB %s EXECUTING", OPAL_JOBID_PRINT(jobid));
if (orte_cmd_options.verbose) {
opal_output(0, "JOB %s EXECUTING", OPAL_JOBID_PRINT(jobid));
}

while (active) {
nanosleep(&tp, NULL);
Expand Down Expand Up @@ -788,6 +795,86 @@ static int create_app(int argc, char* argv[],
}
}

/* set necessary env variables for external usage from tune conf file*/
int set_from_file = 0;
char **vars = NULL;
if (OPAL_SUCCESS == mca_base_var_process_env_list_from_file(&vars) &&
NULL != vars) {
for (i=0; NULL != vars[i]; i++) {
value = strchr(vars[i], '=');
/* terminate the name of the param */
*value = '\0';
/* step over the equals */
value++;
/* overwrite any prior entry */
opal_setenv(vars[i], value, true, &app->env);
/* save it for any comm_spawn'd apps */
opal_setenv(vars[i], value, true, &orte_forwarded_envars);
}
set_from_file = 1;
opal_argv_free(vars);
}
/* Did the user request to export any environment variables on the cmd line? */
char *env_set_flag;
env_set_flag = getenv("OMPI_MCA_mca_base_env_list");
if (opal_cmd_line_is_taken(orte_cmd_line, "x")) {
if (NULL != env_set_flag) {
opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false);
return ORTE_ERR_FATAL;
}
j = opal_cmd_line_get_ninsts(orte_cmd_line, "x");
for (i = 0; i < j; ++i) {
param = opal_cmd_line_get_param(orte_cmd_line, "x", i, 0);

if (NULL != (value = strchr(param, '='))) {
/* terminate the name of the param */
*value = '\0';
/* step over the equals */
value++;
/* overwrite any prior entry */
opal_setenv(param, value, true, &app->env);
/* save it for any comm_spawn'd apps */
opal_setenv(param, value, true, &orte_forwarded_envars);
} else {
value = getenv(param);
if (NULL != value) {
/* overwrite any prior entry */
opal_setenv(param, value, true, &app->env);
/* save it for any comm_spawn'd apps */
opal_setenv(param, value, true, &orte_forwarded_envars);
} else {
opal_output(0, "Warning: could not find environment variable \"%s\"\n", param);
}
}
}
} else if (NULL != env_set_flag) {
/* if mca_base_env_list was set, check if some of env vars were set via -x from a conf file.
* If this is the case, error out.
*/
if (!set_from_file) {
/* set necessary env variables for external usage */
vars = NULL;
if (OPAL_SUCCESS == mca_base_var_process_env_list(env_set_flag, &vars) &&
NULL != vars) {
for (i=0; NULL != vars[i]; i++) {
value = strchr(vars[i], '=');
/* terminate the name of the param */
*value = '\0';
/* step over the equals */
value++;
/* overwrite any prior entry */
opal_setenv(vars[i], value, true, &app->env);
/* save it for any comm_spawn'd apps */
opal_setenv(vars[i], value, true, &orte_forwarded_envars);
}
opal_argv_free(vars);
}
} else {
opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false);
return ORTE_ERR_FATAL;
}
}

/* Did the user request a specific wdir? */

if (NULL != orte_cmd_options.wdir) {
Expand Down