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 2, 2017
1 parent a71eda8 commit c442ba8
Show file tree
Hide file tree
Showing 4 changed files with 954 additions and 126 deletions.
14 changes: 13 additions & 1 deletion include/pmix_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,14 @@ 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_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_proc_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
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
44 changes: 43 additions & 1 deletion 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,6 +29,26 @@

BEGIN_C_DECLS

#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 PMIX_EVENT_CATEGORY_NONE 0x00
#define PMIX_EVENT_CATEGORY_SINGLE 0x01
#define PMIX_EVENT_CATEGORY_MULTI 0x02
#define PMIX_EVENT_CATEGORY_DEF 0x04

/* define a struct for tracking registration ranges */
typedef struct {
pmix_data_range_t range;
pmix_proc_t *procs;
size_t nprocs;
} pmix_range_trkr_t;

/* define an object for tracking event handlers focused on a
* single status code */
typedef struct {
Expand All @@ -38,6 +58,9 @@ typedef struct {
pmix_status_t code;
pmix_notification_fn_t evhdlr;
void *cbobject;
uint8_t precedence;
char *locator;
pmix_range_trkr_t rng;
} pmix_single_event_t;
PMIX_CLASS_DECLARATION(pmix_single_event_t);

Expand All @@ -52,6 +75,9 @@ typedef struct {
size_t ncodes;
pmix_notification_fn_t evhdlr;
void *cbobject;
uint8_t precedence;
char *locator;
pmix_range_trkr_t rng;
} pmix_multi_event_t;
PMIX_CLASS_DECLARATION(pmix_multi_event_t);

Expand All @@ -62,6 +88,9 @@ typedef struct {
size_t index;
pmix_notification_fn_t evhdlr;
void *cbobject;
uint8_t precedence;
char *locator;
pmix_range_trkr_t rng;
} pmix_default_event_t;
PMIX_CLASS_DECLARATION(pmix_default_event_t);

Expand All @@ -79,6 +108,18 @@ PMIX_CLASS_DECLARATION(pmix_active_code_t);
typedef struct {
pmix_object_t super;
size_t nhdlrs;
uint8_t firstcategory;
union {
pmix_single_event_t *sing;
pmix_multi_event_t *multi;
pmix_default_event_t *def;
} first;
uint8_t lastcategory;
union {
pmix_single_event_t *sing;
pmix_multi_event_t *multi;
pmix_default_event_t *def;
} last;
pmix_list_t actives;
pmix_list_t single_events;
pmix_list_t multi_events;
Expand All @@ -98,6 +139,7 @@ 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;
Expand Down
Loading

0 comments on commit c442ba8

Please sign in to comment.