Return thread-local copy of colocation stack.
(self)
| 5038 | |
| 5039 | @property |
| 5040 | def _colocation_stack(self): |
| 5041 | """Return thread-local copy of colocation stack.""" |
| 5042 | if self._stack_state_is_thread_local: |
| 5043 | # This may be called from a thread where colocation_stack doesn't yet |
| 5044 | # exist. |
| 5045 | # pylint: disable=protected-access |
| 5046 | if not hasattr(self._thread_local, "_colocation_stack"): |
| 5047 | stack_copy_for_this_thread = self._graph_colocation_stack.copy() |
| 5048 | self._thread_local._colocation_stack = stack_copy_for_this_thread |
| 5049 | return self._thread_local._colocation_stack |
| 5050 | # pylint: enable=protected-access |
| 5051 | else: |
| 5052 | return self._graph_colocation_stack |
| 5053 | |
| 5054 | def _snapshot_colocation_stack_metadata(self): |
| 5055 | """Return colocation stack metadata as a dictionary.""" |