Skip to content

Commit

Permalink
Implement the event notification extension RFC (pmix/RFCs#18)
Browse files Browse the repository at this point in the history
Signed-off-by: Ralph Castain <rhc@open-mpi.org>
  • Loading branch information
Ralph Castain committed Apr 3, 2017
1 parent a71eda8 commit 88875f0
Show file tree
Hide file tree
Showing 5 changed files with 795 additions and 414 deletions.
18 changes: 15 additions & 3 deletions include/pmix_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,17 @@ typedef uint32_t pmix_rank_t;
#define PMIX_EVENT_HDLR_NAME "pmix.evname" // (char*) string name identifying this handler
#define PMIX_EVENT_JOB_LEVEL "pmix.evjob" // (bool) register for job-specific events only
#define PMIX_EVENT_ENVIRO_LEVEL "pmix.evenv" // (bool) register for environment events only
#define PMIX_EVENT_ORDER_PREPEND "pmix.evprepend" // (bool) prepend this handler to the precedence list
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_proc_t*) array of pmix_proc_t defining range of event notification
#define PMIX_EVENT_HDLR_FIRST "pmix.evfirst" // (bool) invoke this event handler before any other handlers
#define PMIX_EVENT_HDLR_LAST "pmix.evlast" // (bool) invoke this event handler after all other handlers have been called
#define PMIX_EVENT_HDLR_FIRST_IN_CATEGORY "pmix.evfirstcat" // (bool) invoke this event handler before any other handlers in this category
#define PMIX_EVENT_HDLR_LAST_IN_CATEGORY "pmix.evlastcat" // (bool) invoke this event handler after all other handlers in this category have been called
#define PMIX_EVENT_HDLR_BEFORE "pmix.evbefore" // (char*) put this event handler immediately before the one specified in the (char*) value
#define PMIX_EVENT_HDLR_AFTER "pmix.evafter" // (char*) put this event handler immediately after the one specified in the (char*) value
#define PMIX_EVENT_HDLR_PREPEND "pmix.evprepend" // (bool) prepend this handler to the precedence list within its category
#define PMIX_EVENT_HDLR_APPEND "pmix.evappend" // (bool) append this handler to the precedence list within its category
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_data_array_t*) array of pmix_proc_t defining range of event notification
#define PMIX_EVENT_AFFECTED_PROC "pmix.evproc" // (pmix_proc_t) single proc that was affected
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_data_array_t*) array of pmix_proc_t defining affected procs
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
#define PMIX_EVENT_RETURN_OBJECT "pmix.evobject" // (void*) object to be returned whenever the registered cbfunc is invoked
// NOTE: the object will _only_ be returned to the process that
Expand All @@ -260,6 +267,10 @@ typedef uint32_t pmix_rank_t;
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
#define PMIX_EVENT_NO_TERMINATION "pmix.evnoterm" // (bool) indicates that the handler has satisfactorily handled
// the event and believes termination of the application is not required
#define PMIX_EVENT_WANT_TERMINATION "pmix.evterm" // (bool) indicates that the handler has determined that the application should be terminated


/* attributes used to describe "spawn" attributes */
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use
Expand Down Expand Up @@ -635,6 +646,7 @@ typedef uint8_t pmix_data_range_t;
#define PMIX_RANGE_SESSION 4 // data available to all procs in session
#define PMIX_RANGE_GLOBAL 5 // data available to all procs
#define PMIX_RANGE_CUSTOM 6 // range is specified in a pmix_info_t
#define PMIX_RANGE_PROC_LOCAL 7 // restrict range to the local proc

/* define a "persistence" policy for data published by clients */
typedef uint8_t pmix_persistence_t;
Expand Down
56 changes: 26 additions & 30 deletions src/event/pmix_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015-2016 Intel, Inc. All rights reserved
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -29,47 +29,42 @@

BEGIN_C_DECLS

/* define an object for tracking event handlers focused on a
* single status code */
typedef struct {
pmix_list_item_t super;
char *name;
size_t index;
pmix_status_t code;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_single_event_t;
PMIX_CLASS_DECLARATION(pmix_single_event_t);
#define PMIX_EVENT_ORDER_NONE 0x00
#define PMIX_EVENT_ORDER_FIRST 0x01
#define PMIX_EVENT_ORDER_LAST 0x02
#define PMIX_EVENT_ORDER_BEFORE 0x04
#define PMIX_EVENT_ORDER_AFTER 0x08
#define PMIX_EVENT_ORDER_PREPEND 0x10
#define PMIX_EVENT_ORDER_APPEND 0x20

/* define an object for tracking event handlers registered
* on multiple status codes, generally corresponding to a
* functional group */
/* define a struct for tracking registration ranges */
typedef struct {
pmix_list_item_t super;
char *name;
size_t index;
pmix_status_t *codes;
size_t ncodes;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_multi_event_t;
PMIX_CLASS_DECLARATION(pmix_multi_event_t);
pmix_data_range_t range;
pmix_proc_t *procs;
size_t nprocs;
} pmix_range_trkr_t;

/* define an object for tracking default event handlers */
/* define a common struct for tracking event handlers */
typedef struct {
pmix_list_item_t super;
char *name;
size_t index;
uint8_t precedence;
char *locator;
pmix_range_trkr_t rng;
pmix_notification_fn_t evhdlr;
void *cbobject;
} pmix_default_event_t;
PMIX_CLASS_DECLARATION(pmix_default_event_t);
pmix_status_t *codes;
size_t ncodes;
} pmix_event_hdlr_t;
PMIX_CLASS_DECLARATION(pmix_event_hdlr_t);

/* define an object for tracking status codes we are actively
* registered to receive */
typedef struct {
pmix_list_item_t super;
pmix_status_t code;
size_t nregs;
} pmix_active_code_t;
PMIX_CLASS_DECLARATION(pmix_active_code_t);

Expand All @@ -79,6 +74,8 @@ PMIX_CLASS_DECLARATION(pmix_active_code_t);
typedef struct {
pmix_object_t super;
size_t nhdlrs;
pmix_event_hdlr_t *first;
pmix_event_hdlr_t *last;
pmix_list_t actives;
pmix_list_t single_events;
pmix_list_t multi_events;
Expand All @@ -98,15 +95,14 @@ typedef struct pmix_event_chain_t {
pmix_object_t super;
pmix_status_t status;
bool nondefault;
bool endchain;
pmix_proc_t source;
pmix_data_range_t range;
pmix_info_t *info;
size_t ninfo;
pmix_info_t *results;
size_t nresults;
pmix_single_event_t *sing;
pmix_multi_event_t *multi;
pmix_default_event_t *def;
pmix_event_hdlr_t *evhdlr;
pmix_op_cbfunc_t final_cbfunc;
void *final_cbdata;
} pmix_event_chain_t;
Expand Down
Loading

0 comments on commit 88875f0

Please sign in to comment.