-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-introduce the ORTE notifier framework for logging errors that woul…
…d otherwise result in abort for persistent systems. Thanks to L. Rajeshnarayanan of Intel for the contribution Subsequent commits will integrate this capability with the state and errmgr frameworks.
- Loading branch information
Ralph Castain
committed
Feb 16, 2015
1 parent
0bb1dfe
commit 22f1d29
Showing
18 changed files
with
1,852 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
# University Research and Technology | ||
# Corporation. All rights reserved. | ||
# Copyright (c) 2004-2005 The University of Tennessee and The University | ||
# of Tennessee Research Foundation. All rights | ||
# reserved. | ||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
# University of Stuttgart. All rights reserved. | ||
# Copyright (c) 2004-2005 The Regents of the University of California. | ||
# All rights reserved. | ||
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. | ||
# Copyright (c) 2014 Intel, Inc. All rights reserved. | ||
# $COPYRIGHT$ | ||
# | ||
# Additional copyrights may follow | ||
# | ||
# $HEADER$ | ||
# | ||
|
||
# main library setup | ||
noinst_LTLIBRARIES = libmca_notifier.la | ||
libmca_notifier_la_SOURCES = | ||
|
||
# local files | ||
headers = notifier.h | ||
|
||
libmca_notifier_la_SOURCES += $(headers) | ||
|
||
# Conditionally install the header files | ||
if WANT_INSTALL_HEADERS | ||
ortedir = $(includedir)/openmpi/$(subdir) | ||
nobase_orte_HEADERS = $(headers) | ||
endif | ||
|
||
include base/Makefile.am | ||
|
||
distclean-local: | ||
rm -f base/static-components.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
# University Research and Technology | ||
# Corporation. All rights reserved. | ||
# Copyright (c) 2004-2005 The University of Tennessee and The University | ||
# of Tennessee Research Foundation. All rights | ||
# reserved. | ||
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
# University of Stuttgart. All rights reserved. | ||
# Copyright (c) 2004-2005 The Regents of the University of California. | ||
# All rights reserved. | ||
# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. | ||
# Copyright (c) 2014-2015 Intel, Inc. All rights reserved. | ||
# | ||
# $COPYRIGHT$ | ||
# | ||
# Additional copyrights may follow | ||
# | ||
# $HEADER$ | ||
# | ||
|
||
headers += \ | ||
base/base.h | ||
|
||
libmca_notifier_la_SOURCES += \ | ||
base/notifier_base_frame.c \ | ||
base/notifier_base_select.c \ | ||
base/notifier_base_fns.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
* University Research and Technology | ||
* Corporation. All rights reserved. | ||
* Copyright (c) 2004-2005 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. | ||
* | ||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. | ||
* | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
/** @file: | ||
*/ | ||
|
||
#ifndef MCA_NOTIFIER_BASE_H | ||
#define MCA_NOTIFIER_BASE_H | ||
|
||
/* | ||
* includes | ||
*/ | ||
#include "orte_config.h" | ||
|
||
#include "opal/class/opal_list.h" | ||
#include "opal/mca/base/base.h" | ||
#include "opal/mca/event/event.h" | ||
|
||
#include "orte/mca/notifier/notifier.h" | ||
|
||
BEGIN_C_DECLS | ||
|
||
/* | ||
* MCA Framework | ||
*/ | ||
ORTE_DECLSPEC extern mca_base_framework_t orte_notifier_base_framework; | ||
|
||
typedef struct { | ||
opal_event_base_t *ev_base; | ||
bool ev_base_active; | ||
opal_pointer_array_t modules; | ||
orte_notifier_severity_t severity_level; | ||
char *default_actions; | ||
char *emerg_actions; | ||
char *alert_actions; | ||
char *crit_actions; | ||
char *warn_actions; | ||
char *notice_actions; | ||
char *info_actions; | ||
char *debug_actions; | ||
char *error_actions; | ||
} orte_notifier_base_t; | ||
|
||
/* | ||
* Type for holding selected module / component pairs | ||
*/ | ||
typedef struct { | ||
opal_list_item_t super; | ||
/* Component */ | ||
orte_notifier_base_component_t *component; | ||
/* Module */ | ||
orte_notifier_base_module_t *module; | ||
/* Priority */ | ||
int priority; | ||
} orte_notifier_active_module_t; | ||
OBJ_CLASS_DECLARATION(orte_notifier_active_module_t); | ||
|
||
typedef struct { | ||
opal_object_t super; | ||
opal_event_t ev; | ||
char **modules; | ||
orte_notifier_severity_t severity; | ||
int errcode; | ||
const char *msg; | ||
va_list *ap; | ||
} orte_notifier_request_t; | ||
OBJ_CLASS_DECLARATION(orte_notifier_request_t); | ||
|
||
ORTE_DECLSPEC extern orte_notifier_base_t orte_notifier_base; | ||
ORTE_DECLSPEC extern orte_notifier_severity_t orte_notifier_severity; | ||
/* select a component */ | ||
ORTE_DECLSPEC int orte_notifier_base_select(void); | ||
/* log function */ | ||
ORTE_DECLSPEC void orte_notifier_base_log(orte_notifier_severity_t severity, | ||
int errcode, const char *msg, ...); | ||
/* severity to string */ | ||
ORTE_DECLSPEC const char* orte_notifier_base_sev2str(orte_notifier_severity_t severity); | ||
END_C_DECLS | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana | ||
* University Research and Technology | ||
* Corporation. All rights reserved. | ||
* Copyright (c) 2004-2005 The University of Tennessee and The University | ||
* of Tennessee Research Foundation. All rights | ||
* reserved. | ||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, | ||
* University of Stuttgart. All rights reserved. | ||
* Copyright (c) 2004-2005 The Regents of the University of California. | ||
* All rights reserved. | ||
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. | ||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. | ||
* $COPYRIGHT$ | ||
* | ||
* Additional copyrights may follow | ||
* | ||
* $HEADER$ | ||
*/ | ||
|
||
|
||
#include "orte_config.h" | ||
|
||
#include "opal/mca/event/event.h" | ||
#include "opal/runtime/opal_progress_threads.h" | ||
|
||
#include "orte/constants.h" | ||
#include "orte/mca/ess/ess.h" | ||
#include "orte/util/error_strings.h" | ||
#include "orte/util/name_fns.h" | ||
#include "orte/runtime/orte_globals.h" | ||
|
||
#include "orte/mca/notifier/base/base.h" | ||
|
||
|
||
static void process_log(int fd, short args, void *cbdata) | ||
{ | ||
int i = 0, j = 0; | ||
orte_notifier_active_module_t *i_module; | ||
orte_notifier_request_t *req = (orte_notifier_request_t *)cbdata; | ||
char **modules = req->modules; | ||
|
||
/* call the log function of all modules in priority order */ | ||
for (i = 0; i < orte_notifier_base.modules.size; i++) { | ||
if (NULL == (i_module = (orte_notifier_active_module_t*)opal_pointer_array_get_item (&orte_notifier_base.modules, i))) { | ||
continue; | ||
} | ||
for (j = 0; NULL != modules[j]; j++) { | ||
if (0 == strncasecmp(i_module->component->base_version.mca_component_name, modules[j], strlen(modules[j]))) { | ||
if (NULL != i_module->module->log) { | ||
i_module->module->log(req->severity, req->errcode, req->msg, req->ap); | ||
va_end(*req->ap); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
void orte_notifier_base_log(orte_notifier_severity_t severity, | ||
int errcode, const char *msg, ...) | ||
{ | ||
va_list ap; | ||
char **modules; | ||
orte_notifier_request_t *req; | ||
|
||
/* if no modules are active, then there is nothing to do */ | ||
if (0 == orte_notifier_base.modules.size) { | ||
return; | ||
} | ||
|
||
/* check if the severity is >= severity level set for reporting */ | ||
if (orte_notifier_base.severity_level < severity ) { | ||
return; | ||
} | ||
|
||
if (ORTE_NOTIFIER_EMERG == severity && | ||
(NULL != orte_notifier_base.emerg_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.emerg_actions, ','); | ||
} else if (ORTE_NOTIFIER_ALERT == severity && | ||
(NULL != orte_notifier_base.alert_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.alert_actions, ','); | ||
} else if (ORTE_NOTIFIER_CRIT == severity && | ||
(NULL != orte_notifier_base.crit_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.crit_actions, ','); | ||
} else if (ORTE_NOTIFIER_WARN == severity && | ||
(NULL != orte_notifier_base.warn_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.warn_actions, ','); | ||
} else if (ORTE_NOTIFIER_NOTICE == severity && | ||
(NULL != orte_notifier_base.notice_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.notice_actions, ','); | ||
} else if (ORTE_NOTIFIER_INFO == severity && | ||
(NULL != orte_notifier_base.info_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.info_actions, ','); | ||
} else if (ORTE_NOTIFIER_DEBUG == severity && | ||
(NULL != orte_notifier_base.debug_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.debug_actions, ','); | ||
} else if (ORTE_NOTIFIER_ERROR == severity && | ||
(NULL != orte_notifier_base.error_actions)) { | ||
modules = opal_argv_split(orte_notifier_base.error_actions, ','); | ||
} else if (NULL != orte_notifier_base.default_actions) { | ||
modules = opal_argv_split(orte_notifier_base.default_actions, ','); | ||
} else { | ||
/* no modules selected */ | ||
return; | ||
} | ||
|
||
/* set the event base and push this request into event base | ||
*/ | ||
req = OBJ_NEW(orte_notifier_request_t); | ||
|
||
req->modules = modules; | ||
req->severity = severity; | ||
req->errcode = errcode; | ||
req->msg = msg; | ||
va_start(ap, msg); | ||
req->ap = ≈ | ||
|
||
/* | ||
* set the event and activate | ||
*/ | ||
opal_event_set(orte_notifier_base.ev_base, &req->ev, -1, | ||
OPAL_EV_WRITE, | ||
process_log, req); | ||
opal_event_set_priority(&req->ev, OPAL_EV_SYS_HI_PRI); | ||
opal_event_active (&req->ev, OPAL_EV_WRITE, 1); | ||
} | ||
|
||
|
||
const char* orte_notifier_base_sev2str(orte_notifier_severity_t severity) | ||
{ | ||
switch (severity) { | ||
case ORTE_NOTIFIER_EMERG: return "EMERG"; break; | ||
case ORTE_NOTIFIER_ALERT: return "ALERT"; break; | ||
case ORTE_NOTIFIER_CRIT: return "CRIT"; break; | ||
case ORTE_NOTIFIER_ERROR: return "ERROR"; break; | ||
case ORTE_NOTIFIER_WARN: return "WARN"; break; | ||
case ORTE_NOTIFIER_NOTICE: return "NOTICE"; break; | ||
case ORTE_NOTIFIER_INFO: return "INFO"; break; | ||
case ORTE_NOTIFIER_DEBUG: return "DEBUG"; break; | ||
default: return "UNKNOWN"; break; | ||
} | ||
} | ||
|
Oops, something went wrong.