cytoflowgui.utility.event_tracer#
Record trait change events in single and multi-threaded environments. Adapted from https://docs.enthought.com/traits/_modules/traits/util/event_tracer.html
- class cytoflowgui.utility.event_tracer.SentinelRecord[source]#
Bases:
objectSentinel record to separate groups of chained change event dispatches.
- class cytoflowgui.utility.event_tracer.ChangeMessageRecord(time, indent, name, old, new, class_name)[source]#
Bases:
objectMessage record for a change event dispatch.
- time#
Time stamp in UTC.
- indent#
Depth level in a chain of trait change dispatches.
- name#
The name of the trait that changed
- old#
The old value.
- new#
The new value.
- class_name#
The name of the class that the trait change took place.
- class cytoflowgui.utility.event_tracer.CallingMessageRecord(time, indent, handler, source)[source]#
Bases:
objectMessage record for a change handler call.
- time#
Time stamp in UTC.
- indent#
Depth level of the call in a chain of trait change dispatches.
- handler#
The traits change handler that is called.
- source#
The source file where the handler was defined.
- class cytoflowgui.utility.event_tracer.ExitMessageRecord(time, indent, handler, exception)[source]#
Bases:
objectMessage record for returning from a change event dispatch.
- time#
Time stamp in UTC.
- indent#
Depth level of the exit in a chain of trait change dispatch.
- handler#
The traits change handler that is called.
- exception#
The exception type (if one took place)
- class cytoflowgui.utility.event_tracer.RecordContainer[source]#
Bases:
objectA simple record container.
This class is commonly used to hold records from a single thread.
- class cytoflowgui.utility.event_tracer.MultiThreadRecordContainer[source]#
Bases:
objectA container of record containers that are used by separate threads.
Each record container is mapped to a thread name id. When a RecordContainer does not exist for a specific thread a new empty RecordContainer will be created on request.
- class cytoflowgui.utility.event_tracer.ChangeEventRecorder(container)[source]#
Bases:
objectA single thread trait change event recorder.
- class cytoflowgui.utility.event_tracer.MultiThreadChangeEventRecorder(container)[source]#
Bases:
objectA thread aware trait change recorder.
The class manages multiple ChangeEventRecorders which record trait change events for each thread in a separate file.
- cytoflowgui.utility.event_tracer.record_events()[source]#
Multi-threaded trait change event tracer.:
from trace_recorder import record_events with record_events() as change_event_container: my_model.some_trait = True change_event_container.save_to_directory('C:\dev\trace')
This will install a tracer that will record all events that occur from setting of some_trait on the my_model instance.
The results will be stored in one file per running thread in the directory ‘C:devtrace’. The files are named after the thread being traced.