orcm/tools/orun/orun.c
/* process incoming messages in order of receipt */
process incoming messages in order of receipt
process incoming messages in order of receipt
static void orun_recv(int status, orte_process_name_t *sender,
                       opal_buffer_t *buffer, orte_rml_tag_t tag,
                       void* cbdata)
{
    orte_job_t *jdata;
    orte_proc_t *proc;
    orte_proc_state_t *state;
    int proc_exit_code;
    char *nodename;
    int command;
    int count = 1; 
    int32_t rc = ORTE_SUCCESS;
    printf("orun_recv - JOB_COMPLETE\n");
    if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &command, &count, 
                                              OPAL_INT))) {
        ORTE_ERROR_LOG(rc);
        OBJ_RELEASE(buffer);
    }
    switch (command) {
        case ORTE_DAEMON_TERMINATE_JOB_CMD:
            count = 1;
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &jdata, 
                                                      &count, ORTE_JOB))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            break;
        case ORTE_DAEMON_ABORT_PROCS_CALLED:
            count = 1;
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &jdata, 
                                                      &count, ORTE_JOB))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &proc, 
                                                      &count, ORTE_PROC))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &state, 
                                                      &count, ORTE_PROC_STATE))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &proc_exit_code, 
                                                      &count, ORTE_EXIT_CODE))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            if (ORTE_SUCCESS != (rc = opal_dss.unpack(buffer, &nodename, 
                                                      &count, OPAL_STRING))) {
                ORTE_ERROR_LOG(rc);
                OBJ_RELEASE(buffer);
            }
            report_aborted_procs(jdata, proc, state, &proc_exit_code, nodename);
            rc = proc_exit_code;
            break;
        default:
            ORTE_ERROR_LOG(ORTE_ERR_VALUE_OUT_OF_BOUNDS);
            rc = ORTE_ERR_VALUE_OUT_OF_BOUNDS;
            OBJ_RELEASE(buffer);
            break;
    }
    orte_odls.kill_local_procs(NULL);
    orte_finalize();
    if (orte_debug_flag) {
        printf("exiting with status %d\n", rc);
    }
    exit(rc);
}
static void orun_recv ( int status , orte_process_name_t * sender , opal_buffer_t * buffer , orte_rml_tag_t tag , void * cbdata ) { orte_job_t * jdata ; orte_proc_t * proc ; orte_proc_state_t * state ; int proc_exit_code ; char * nodename ; int command ; int count = 1 ; int32_t rc = ORTE_SUCCESS ; printf ( " \n " ) ; if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & command , & count , OPAL_INT ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } switch ( command ) { case ORTE_DAEMON_TERMINATE_JOB_CMD : count = 1 ; if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & jdata , & count , ORTE_JOB ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } break ; case ORTE_DAEMON_ABORT_PROCS_CALLED : count = 1 ; if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & jdata , & count , ORTE_JOB ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & proc , & count , ORTE_PROC ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & state , & count , ORTE_PROC_STATE ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & proc_exit_code , & count , ORTE_EXIT_CODE ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } if ( ORTE_SUCCESS != ( rc = opal_dss . unpack ( buffer , & nodename , & count , OPAL_STRING ) ) ) { ORTE_ERROR_LOG ( rc ) ; OBJ_RELEASE ( buffer ) ; } report_aborted_procs ( jdata , proc , state , & proc_exit_code , nodename ) ; rc = proc_exit_code ; break ; default : ORTE_ERROR_LOG ( ORTE_ERR_VALUE_OUT_OF_BOUNDS ) ; rc = ORTE_ERR_VALUE_OUT_OF_BOUNDS ; OBJ_RELEASE ( buffer ) ; break ; } orte_odls . kill_local_procs ( NULL ) ; orte_finalize ( ) ; if ( orte_debug_flag ) { printf ( " \n " , rc ) ; } exit ( rc ) ; }
process incoming messages in order of receipt
process incoming messages in order of receipt
/* unpack job object */ /* unpack job object */ /* ensure all local procs are dead */ /* cleanup and leave */