def get_trace_component_for_trigger_instance(trigger_instance_db):
 trace_component = {}
 trace_component = {'id': str(trigger_instance_db.id), 'ref': trigger_instance_db.trigger}
 caused_by = {}
 if ((trigger_instance_db.trigger == ACTION_SENSOR_TRIGGER_REF) or (trigger_instance_db.trigger == NOTIFY_TRIGGER_REF)):
  caused_by['type'] = 'action_execution'
  caused_by['id'] = trigger_instance_db.payload['execution_id']
 trace_component['caused_by'] = caused_by
 return trace_component

def get_trace_component_for_trigger_instance ( trigger_instance_db ) : trace_component = { } trace_component = { 'id' : str ( trigger_instance_db . id ) , 'ref' : trigger_instance_db . trigger } caused_by = { } if ( ( trigger_instance_db . trigger == ACTION_SENSOR_TRIGGER_REF ) or ( trigger_instance_db . trigger == NOTIFY_TRIGGER_REF ) ) : caused_by [ 'type' ] = 'action_execution' caused_by [ 'id' ] = trigger_instance_db . payload [ 'execution_id' ] trace_component [ 'caused_by' ] = caused_by return trace_component
returns the trace_component compatible dict representation of a triggerinstance .