selinon.trace module¶
Built-in tracing mechanism.
A list of events that can be traced:
Event | Event description | Emitter | msg_dict.keys() |
---|---|---|---|
FLOW_SCHEDULE | A flow has been scheduled. | Msg producer | dispatcher_id, selective, queue, node_args, flow_name |
DISPATCHER_WAKEUP | Dispatcher was started and will check flow status. | Dispatcher | dispatcher_id, state, selective, retry, queue, node_args, flow_name |
FLOW_START | A new flow is starting, this event is emitted on after DISPATCHER_WAKEUP. | Dispatcher | dispatcher_id, selective, queue, node_args, flow_name |
TASK_SCHEDULE | Emitted when a new task is scheduled by dispatcher. | Dispatcher | countdown, condition_str, task_name, queue, node_args, dispatcher_id, parent, task_id, selective, foreach_str, flow_name, selective_edge |
TASK_START | Emitted when a task is going to be executed on worker side. | Task | |
SUBFLOW_SCHEDULE | Emitted when a flow is scheduled by dispatcher. | Dispatcher | |
TASK_END | Signalizing end of task execution, task finished successfully. | Task | |
NODE_SUCCESSFUL | Signalizing that a node in flow graph (task or flow) successfully finished. | Dispatcher | |
TASK_DISCARD_RESULT | Signalizing that a task returned a value other than None, but no storage was assigned to task to store result. | Task | |
TASK_FAILURE | Signalizing end of task, task raised an exception, marking task as failed. | Task | |
TASK_RETRY | Signalizing that a task failed by, raising an exception and will be retried. | Task | |
FLOW_FAILURE | Signalization of flow failure, one more nodes in flow graph failed without successful fallback run. | Dispatcher | |
DISPATCHER_FAILURE | This event shouldn’t be normally seen - signalizing error in Selinon. | Dispatcher | |
NODE_FAILURE | Signalization of captured failure of node in task flow graph - flow or task failure. | Dispatcher | |
FALLBACK_START | Fallback for node failures in flow is started to handle node failures. | Dispatcher | |
DISPATCHER_RETRY | Dispatcher finished scheduling new nodes and will retry to check flow status after a while. | Dispatcher | dispatcher_id, state, selective, retry, queue, node_args, state_dict, flow_name, parent |
FLOW_END | Flow has successfully ended. | Dispatcher | |
MIGRATION | Flow has migration was done. | Dispatcher | |
MIGRATION_TAINTED_FLOW | Signalization of tainted flow when migration was run. | Dispatcher | |
MIGRATION_SKEW | Flow migration has error - skewed migration. | Dispatcher | |
STORAGE_CONNECT | Given node did not connect to storage yet so a new connection is requested by calling DataStorage.connect() | Dispatcher/Task | storage_name |
STORAGE_DISCONNECT | Called when disconnecting from storage by calling DataStorage.disconnect() | storage adapter destructor | |
STORAGE_RETRIEVE | Retrieve task result from storage that was assigned to the task. | Dispatcher/Task | |
STORAGE_RETRIEVED | Requested result of task was retrieved. | Dispatcher/Task | |
STORAGE_STORE | Store result of task in the assigned storage. | Task | |
STORAGE_STORED | The result of task has been stored in the assigned storage. | Task | |
EDGE_COND_FALSE | The condition on edge was evaluated as false so destination nodes will not be scheduled. | Dispatcher | |
FOREACH_RESULT | Reports result of foreach function, based on which N nodes will be scheduled (N is runtime variable) | Dispatcher | |
NODE_STATE_CACHE_GET | Requested state of the node (if the node was successful or failed) from cache. | Dispatcher | |
NODE_STATE_CACHE_ADD | Requested entry in the state cache was not found and the node succeeded so new entry to state is added. | Dispatcher | |
NODE_STATE_CACHE_MISS | Requested entry was not found in state cache. | Dispatcher | |
NODE_STATE_CACHE_HIT | Requested entry was found in the state cache and will be used. | Dispatcher | |
TASK_RESULT_CACHE_GET | Try to hit result cache for cached already requested task result. | Dispatcher/Task | |
TASK_RESULT_CACHE_ADD | Add to result cache result of a task that was requested. | Dispatcher/Task | |
TASK_RESULT_CACHE_MISS | Requested task result was not found in the result cache. | Dispatcher/Task | |
TASK_RESULT_CACHE_HIT | Requested task result was found in the result cache. | Dispatcher/Task | |
SELECTIVE_OMIT_EDGE | Given edge will not be fired as it is not part of direct path to requested tasks on selective run. | Dispatcher | |
SELECTIVE_OMIT_NODE | The desired node will not be scheduled as it is not requested task nor dependency of requested task in selective task runs. | Dispatcher | |
SELECTIVE_RUN_FUNC | Keeps track of results of selective run function on selective task runs. | Dispatcher | dispatcher_id, parent, selective, node_args, flow_name, result, node_name |
SELECTIVE_TASK_REUSE | Signalizes reuse of already computed results in selective task runs. | Dispatcher | |
STORAGE_STORE_ERROR | Signalizes storing error information in assigned storage on task failure. | Task | |
STORAGE_OMIT_STORE_ERROR | Signalizes that storing error will not be done - missing storage adapter or store_error() is not implemented. | Task |
-
class
selinon.trace.
Trace
[source]¶ Bases:
object
Trace system flow actions.
-
DISPATCHER_FAILURE
= 12¶
-
DISPATCHER_RETRY
= 15¶
-
DISPATCHER_WAKEUP
= 0¶
-
EAGER_FAILURE
= 50¶
-
EDGE_COND_FALSE
= 23¶
-
FALLBACK_COND_FALSE
= 39¶
-
FALLBACK_COND_TRUE
= 40¶
-
FALLBACK_START
= 14¶
-
FLOW_END
= 16¶
-
FLOW_FAILURE
= 11¶
-
FLOW_RETRY
= 45¶
-
FLOW_SCHEDULE
= 1¶
-
FLOW_START
= 2¶
-
FOREACH_RESULT
= 24¶
-
MIGRATION
= 46¶
-
MIGRATION_ERROR
= 49¶
-
MIGRATION_SKEW
= 47¶
-
MIGRATION_TAINTED_FLOW
= 48¶
-
NODE_FAILURE
= 13¶
-
NODE_STATE_CACHE_ADD
= 26¶
-
NODE_STATE_CACHE_GET
= 25¶
-
NODE_STATE_CACHE_HIT
= 28¶
-
NODE_STATE_CACHE_ISSUE
= 41¶
-
NODE_STATE_CACHE_MISS
= 27¶
-
NODE_SUCCESSFUL
= 7¶
-
RESULT_BACKEND_ISSUE
= 44¶
-
SELECTIVE_OMIT_EDGE
= 33¶
-
SELECTIVE_OMIT_NODE
= 34¶
-
SELECTIVE_RUN_FUNC
= 35¶
-
SELECTIVE_TASK_REUSE
= 36¶
-
STORAGE_CONNECT
= 17¶
-
STORAGE_DELETE
= 51¶
-
STORAGE_DELETED
= 52¶
-
STORAGE_DISCONNECT
= 18¶
-
STORAGE_ISSUE
= 43¶
-
STORAGE_OMIT_STORE_ERROR
= 38¶
-
STORAGE_RETRIEVE
= 19¶
-
STORAGE_RETRIEVED
= 20¶
-
STORAGE_STORE
= 21¶
-
STORAGE_STORED
= 22¶
-
STORAGE_STORE_ERROR
= 37¶
-
SUBFLOW_SCHEDULE
= 5¶
-
TASK_DISCARD_RESULT
= 8¶
-
TASK_END
= 6¶
-
TASK_FAILURE
= 9¶
-
TASK_RESULT_CACHE_ADD
= 30¶
-
TASK_RESULT_CACHE_GET
= 29¶
-
TASK_RESULT_CACHE_HIT
= 32¶
-
TASK_RESULT_CACHE_ISSUE
= 42¶
-
TASK_RESULT_CACHE_MISS
= 31¶
-
TASK_RETRY
= 10¶
-
TASK_SCHEDULE
= 3¶
-
TASK_START
= 4¶
-
WARN_EVENTS
= (13, 8, 10, 9, 11, 38, 41, 42, 43, 44, 45, 47, 49, 50)¶
-
classmethod
event2str
(event)[source]¶ Translate event to it’s string representation.
Parameters: event – event Returns: string representation of event
-
classmethod
json_trace_func
(event, msg_dict)[source]¶ Trace by directly printing JSONs to stdout or stderr.
Parameters: - event – event that triggered trace point
- msg_dict – a dict holding additional trace information for event
-
classmethod
log
(event, *msg_dict, **msg_dict_kwargs)[source]¶ Log an event.
Parameters: - event – tracing event
- msg_dict – message to be printed
- msg_dict_kwargs – kwargs like dictionary for traced details
-
classmethod
logging_trace_func
(event, msg_dict, logger=None)[source]¶ Trace to Python’s logging facilities.
Parameters: - event – event that triggered trace point
- msg_dict – a dict holding additional trace information for event
- logger – a logger to be used, if None, logger from trace_by_logging will be used
-
classmethod
trace_by_func
(func)[source]¶ Trace by a custom function.
Parameters: func – function with a one single argument
-
classmethod
trace_by_logging
(logger=None)[source]¶ Trace by using Python’s logging.
Parameters: logger – optional logger that should be used
-
classmethod
trace_by_sentry
(dsn)[source]¶ Trace using Sentry (see https://sentry.io).
Parameters: dsn – data source name for connecting to Sentry
-