Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::GraphSignalHandler< Separator, AllTypes > Class Template Reference

Implements a signal handler to catch events such as termination and killing. More...

#include "graph_signal_handler.h"

Collaboration diagram for hh::GraphSignalHandler< Separator, AllTypes >:
Collaboration graph

Static Public Member Functions

static void handleSignal (int signum=SIGTERM)
 Function that handles signals.
 
static void atExit ()
 Create a dot file at exit if the instance still exist.
 
static void setColorScheme (ColorScheme scheme)
 Sets the color scheme for dot file generation.
 
static void setStructureOptions (StructureOptions options)
 Sets the structure options for dot file generation.
 
static void setDebugOptions (DebugOptions options)
 Sets the debug options for dot file generation.
 
static void registerGraph (Graph< Separator, AllTypes... > *graph)
 Registers a task graph to be displayed when a signal is fired.
 
static void registerSignal (int signum=SIGTERM, bool atExit=false)
 Registers a signal for handling. (default SIGTERM)
 

Static Private Attributes

static Graph< Separator, AllTypes... > * graphInstance_ = nullptr
 < The outer graph instance
 
static bool signalHandled_ = false
 Flag to indicate if a signal has been fired or not.
 
static ColorScheme colorScheme = ColorScheme::EXECUTION
 < The color scheme to use for graph dot file
 
static StructureOptions structureOptions = StructureOptions::ALL
 < The structure options to use for graph dot file
 
static DebugOptions debugOptions = DebugOptions::ALL
 < The debug options to use for graph dot file
 

Detailed Description

template<size_t Separator, class ... AllTypes>
class hh::GraphSignalHandler< Separator, AllTypes >

Implements a signal handler to catch events such as termination and killing.

Once a signal is caught, all task graphs that are registered with the signal handler will be written as a dot file. The dot file is output in the working directory with the name of the signal as a prefix and '<#>-graph-output.dot' as the suffix. This can be used to help debug the graph and understand the state of the graph. For example, if the graph is deadlocked and the kill signal is handled, then the graph will be saved when terminating the program. Visualizing the graph can pinpoint the location of the deadlock.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 39 of file graph_signal_handler.h.

Member Function Documentation

◆ atExit()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::atExit ( )
inlinestatic

Create a dot file at exit if the instance still exist.

Definition at line 69 of file graph_signal_handler.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSignal()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::handleSignal ( int  signum = SIGTERM)
inlinestatic

Function that handles signals.

Use TaskGraphSignalHandler::registerSignal to signal to this function

Attention
This function is used by the signal handler that is registered from std::signal, and should not be called directly by the user.
Parameters
signumthe signal number that was triggered

Definition at line 53 of file graph_signal_handler.h.

Here is the call graph for this function:

◆ registerGraph()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::registerGraph ( Graph< Separator, AllTypes... > *  graph)
inlinestatic

Registers a task graph to be displayed when a signal is fired.

Parameters
graphthe task graph to be displayed.

Definition at line 94 of file graph_signal_handler.h.

◆ registerSignal()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::registerSignal ( int  signum = SIGTERM,
bool  atExit = false 
)
inlinestatic

Registers a signal for handling. (default SIGTERM)

Parameters
signumSignal number id
atExitBoolean to test if GraphSignalHandler::atExit is called

Definition at line 101 of file graph_signal_handler.h.

Here is the call graph for this function:

◆ setColorScheme()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::setColorScheme ( ColorScheme  scheme)
inlinestatic

Sets the color scheme for dot file generation.

Parameters
schemethe color scheme

Definition at line 76 of file graph_signal_handler.h.

◆ setDebugOptions()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::setDebugOptions ( DebugOptions  options)
inlinestatic

Sets the debug options for dot file generation.

Parameters
optionsthe debug options

Definition at line 88 of file graph_signal_handler.h.

◆ setStructureOptions()

template<size_t Separator, class ... AllTypes>
static void hh::GraphSignalHandler< Separator, AllTypes >::setStructureOptions ( StructureOptions  options)
inlinestatic

Sets the structure options for dot file generation.

Parameters
optionsthe structure options

Definition at line 82 of file graph_signal_handler.h.

Member Data Documentation

◆ colorScheme

template<size_t Separator, class ... AllTypes>
ColorScheme hh::GraphSignalHandler< Separator, AllTypes >::colorScheme = ColorScheme::EXECUTION
staticprivate

< The color scheme to use for graph dot file

Sets the default color scheme.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 43 of file graph_signal_handler.h.

◆ debugOptions

template<size_t Separator, class ... AllTypes>
DebugOptions hh::GraphSignalHandler< Separator, AllTypes >::debugOptions = DebugOptions::ALL
staticprivate

< The debug options to use for graph dot file

Sets the default debug options.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 45 of file graph_signal_handler.h.

◆ graphInstance_

template<size_t Separator, class ... AllTypes>
Graph< Separator, AllTypes... > * hh::GraphSignalHandler< Separator, AllTypes >::graphInstance_ = nullptr
staticprivate

< The outer graph instance

Set default value at nullptr.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 41 of file graph_signal_handler.h.

◆ signalHandled_

template<size_t Separator, class ... AllTypes>
bool hh::GraphSignalHandler< Separator, AllTypes >::signalHandled_ = false
staticprivate

Flag to indicate if a signal has been fired or not.

Set default value at false.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 42 of file graph_signal_handler.h.

◆ structureOptions

template<size_t Separator, class ... AllTypes>
StructureOptions hh::GraphSignalHandler< Separator, AllTypes >::structureOptions = StructureOptions::ALL
staticprivate

< The structure options to use for graph dot file

Sets the default structure options.

Template Parameters
SeparatorSeparator position between input types and output types
AllTypesList of input and output types

Definition at line 44 of file graph_signal_handler.h.