MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _init_trace_threadlocal

Method _init_trace_threadlocal

monai/transforms/inverse.py:74–83  ·  view source on GitHub ↗

Create a `_tracing` instance member to store the thread-local tracing state value.

(self)

Source from the content-addressed store, hash-verified

72 """
73
74 def _init_trace_threadlocal(self):
75 """Create a `_tracing` instance member to store the thread-local tracing state value."""
76 # needed since this class is meant to be a trait with no constructor
77 if not hasattr(self, "_tracing"):
78 self._tracing = threading.local()
79
80 # This is True while the above initialising _tracing is False when this is
81 # called from a different thread than the one initialising _tracing.
82 if not hasattr(self._tracing, "value"):
83 self._tracing.value = MONAIEnvVars.trace_transform() != "0"
84
85 def __getstate__(self):
86 """When pickling, remove the `_tracing` member from the output, if present, since it's not picklable."""

Callers 2

tracingMethod · 0.95
get_transform_infoMethod · 0.95

Calls 1

trace_transformMethod · 0.45

Tested by

no test coverage detected