MCPcopy Create free account
hub / github.com/StackStorm/st2 / _get_single_trace_by_component

Function _get_single_trace_by_component

st2common/st2common/services/trace.py:73–85  ·  view source on GitHub ↗

Tries to return a single Trace mathing component_filter. Raises an exception when a filter matches multiple.

(**component_filter)

Source from the content-addressed store, hash-verified

71
72
73def _get_single_trace_by_component(**component_filter):
74 """
75 Tries to return a single Trace mathing component_filter. Raises an exception
76 when a filter matches multiple.
77 """
78 traces = Trace.query(**component_filter)
79 if len(traces) == 0:
80 return None
81 elif len(traces) > 1:
82 raise UniqueTraceNotFoundException(
83 "More than 1 trace matching %s found." % component_filter
84 )
85 return traces[0]
86
87
88def get_trace_db_by_action_execution(action_execution=None, action_execution_id=None):

Calls 2

queryMethod · 0.45

Tested by

no test coverage detected