Make it easier to send a kill-local-procs command for an arbitrary number of procs
This commit was SVN r24386.
Этот коммит содержится в:
родитель
bf1cff3711
Коммит
a3607ff35d
@ -257,7 +257,6 @@ int orte_plm_base_orted_kill_local_procs(opal_pointer_array_t *procs)
|
|||||||
orte_process_name_t peer;
|
orte_process_name_t peer;
|
||||||
orte_job_t *daemons;
|
orte_job_t *daemons;
|
||||||
orte_proc_t *proc;
|
orte_proc_t *proc;
|
||||||
int32_t num_procs=0;
|
|
||||||
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output,
|
OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output,
|
||||||
"%s plm:base:orted_cmd sending kill_local_procs cmds",
|
"%s plm:base:orted_cmd sending kill_local_procs cmds",
|
||||||
@ -272,31 +271,6 @@ int orte_plm_base_orted_kill_local_procs(opal_pointer_array_t *procs)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != procs) {
|
|
||||||
/* count the number of procs */
|
|
||||||
for (v=0; v < procs->size; v++) {
|
|
||||||
if (NULL == opal_pointer_array_get_item(procs, v)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
num_procs++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bozo check */
|
|
||||||
if (0 == num_procs) {
|
|
||||||
OPAL_OUTPUT_VERBOSE((5, orte_plm_globals.output,
|
|
||||||
"%s plm:base:orted_cmd:kill_local_procs no procs given",
|
|
||||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
|
||||||
return ORTE_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pack the number of procs */
|
|
||||||
if (ORTE_SUCCESS != (rc = opal_dss.pack(&cmd, &num_procs, 1, OPAL_INT32))) {
|
|
||||||
ORTE_ERROR_LOG(rc);
|
|
||||||
OBJ_DESTRUCT(&cmd);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* pack the proc names */
|
/* pack the proc names */
|
||||||
if (NULL != procs) {
|
if (NULL != procs) {
|
||||||
for (v=0; v < procs->size; v++) {
|
for (v=0; v < procs->size; v++) {
|
||||||
|
@ -390,11 +390,23 @@ int orte_daemon_process_commands(orte_process_name_t* sender,
|
|||||||
|
|
||||||
/**** KILL_LOCAL_PROCS ****/
|
/**** KILL_LOCAL_PROCS ****/
|
||||||
case ORTE_DAEMON_KILL_LOCAL_PROCS:
|
case ORTE_DAEMON_KILL_LOCAL_PROCS:
|
||||||
/* unpack the number of procs */
|
num_replies = 0;
|
||||||
n = 1;
|
|
||||||
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &num_replies, &n, OPAL_INT32))) {
|
/* construct the pointer array */
|
||||||
|
OBJ_CONSTRUCT(&procarray, opal_pointer_array_t);
|
||||||
|
opal_pointer_array_init(&procarray, num_replies, ORTE_GLOBAL_ARRAY_MAX_SIZE, 16);
|
||||||
|
|
||||||
|
/* unpack the proc names into the array */
|
||||||
|
while (ORTE_SUCCESS == (ret = opal_dss.unpack(buffer, &proc, &n, ORTE_NAME))) {
|
||||||
|
proct = OBJ_NEW(orte_proc_t);
|
||||||
|
proct->name.jobid = proc.jobid;
|
||||||
|
proct->name.vpid = proc.vpid;
|
||||||
|
opal_pointer_array_add(&procarray, proct);
|
||||||
|
num_replies++;
|
||||||
|
}
|
||||||
|
if (ORTE_ERR_UNPACK_READ_PAST_END_OF_BUFFER != ret) {
|
||||||
ORTE_ERROR_LOG(ret);
|
ORTE_ERROR_LOG(ret);
|
||||||
goto CLEANUP;
|
goto KILL_PROC_CLEANUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == num_replies) {
|
if (0 == num_replies) {
|
||||||
@ -403,28 +415,11 @@ int orte_daemon_process_commands(orte_process_name_t* sender,
|
|||||||
ORTE_ERROR_LOG(ret);
|
ORTE_ERROR_LOG(ret);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
|
/* kill the procs */
|
||||||
/* construct the pointer array */
|
if (ORTE_SUCCESS != (ret = orte_odls.kill_local_procs(&procarray))) {
|
||||||
OBJ_CONSTRUCT(&procarray, opal_pointer_array_t);
|
|
||||||
opal_pointer_array_init(&procarray, num_replies, ORTE_GLOBAL_ARRAY_MAX_SIZE, 16);
|
|
||||||
|
|
||||||
/* unpack the proc names into the array */
|
|
||||||
for (i=0; i < num_replies; i++) {
|
|
||||||
n = 1;
|
|
||||||
if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &proc, &n, ORTE_NAME))) {
|
|
||||||
ORTE_ERROR_LOG(ret);
|
ORTE_ERROR_LOG(ret);
|
||||||
goto KILL_PROC_CLEANUP;
|
|
||||||
}
|
}
|
||||||
proct = OBJ_NEW(orte_proc_t);
|
|
||||||
proct->name.jobid = proc.jobid;
|
|
||||||
proct->name.vpid = proc.vpid;
|
|
||||||
opal_pointer_array_add(&procarray, proct);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* kill the procs */
|
|
||||||
if (ORTE_SUCCESS != (ret = orte_odls.kill_local_procs(&procarray))) {
|
|
||||||
ORTE_ERROR_LOG(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user