root/orte/mca/state/state_types.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2011      Los Alamos National Security, LLC.
   3  *                         All rights reserved.
   4  * $COPYRIGHT$
   5  *
   6  * Additional copyrights may follow
   7  *
   8  * $HEADER$
   9  */
  10 
  11 /****    ORTE STATE MACHINE    ****/
  12 
  13 /* States are treated as events so that the event
  14  * library can sequence them. Each state consists
  15  * of an event, a job or process state, a pointer
  16  * to the respective object, and a callback function
  17  * to be executed for that state. Events can be defined
  18  * at different priorities - e.g., SYS priority for
  19  * events associated with launching jobs, and ERR priority
  20  * for events associated with abnormal termination of
  21  * a process.
  22  *
  23  * The state machine consists of a list of state objects,
  24  * each defining a state-cbfunc pair. At startup, a default
  25  * list is created by the base functions which is then
  26  * potentially customized by selected components within
  27  * the various ORTE frameworks. For example, a PLM component
  28  * may need to insert states in the launch procedure, or may
  29  * want to redirect a particular state callback to a custom
  30  * function.
  31  *
  32  * For convenience, an ANY state can be defined along with a generic
  33  * callback function, with the corresponding state object
  34  * placed at the end of the state machine. Setting the
  35  * machine to a state that has not been explicitly defined
  36  * will cause this default action to be executed. Thus, you
  37  * don't have to explicitly define a state-cbfunc pair
  38  * for every job or process state.
  39  */
  40 
  41 #ifndef _ORTE_STATE_TYPES_H_
  42 #define _ORTE_STATE_TYPES_H_
  43 
  44 #include "orte_config.h"
  45 
  46 #include "opal/class/opal_list.h"
  47 #include "opal/mca/event/event.h"
  48 
  49 #include "orte/mca/plm/plm_types.h"
  50 #include "orte/runtime/orte_globals.h"
  51 
  52 BEGIN_C_DECLS
  53 
  54 typedef void (*orte_state_cbfunc_t)(int fd, short args, void* cb);
  55 
  56 typedef struct {
  57     opal_list_item_t super;
  58     orte_job_state_t job_state;
  59     orte_proc_state_t proc_state;
  60     orte_state_cbfunc_t cbfunc;
  61     int priority;
  62 } orte_state_t;
  63 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_state_t);
  64 
  65 /* caddy for passing job and proc data to state event handlers */
  66 typedef struct {
  67     opal_object_t super;
  68     opal_event_t ev;
  69     orte_job_t *jdata;
  70     orte_job_state_t job_state;
  71     orte_process_name_t name;
  72     orte_proc_state_t proc_state;
  73 } orte_state_caddy_t;
  74 ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_state_caddy_t);
  75 
  76 END_C_DECLS
  77 #endif

/* [<][>][^][v][top][bottom][index][help] */