Context manager to track the currently executing atom during script execution. This is used by the reactive runtime to associate component accesses or side effects with the atom currently being evaluated. It enables dynamic dependency tracking by letting systems lik
(self, atom_name: str)
| 55 | |
| 56 | @contextmanager |
| 57 | def active_atom(self, atom_name: str): |
| 58 | """ |
| 59 | Context manager to track the currently executing atom during script execution. |
| 60 | |
| 61 | This is used by the reactive runtime to associate component accesses or side effects |
| 62 | with the atom currently being evaluated. It enables dynamic dependency tracking |
| 63 | by letting systems like the DAG or component registry know which atom is "active" |
| 64 | when a component or value is used. |
| 65 | |
| 66 | Args: |
| 67 | atom_name (str): The name of the atom that is being executed. |
| 68 | """ |
| 69 | |
| 70 | previous_atom = self._current_atom |
| 71 | self._current_atom = atom_name |
| 72 | try: |
| 73 | yield |
| 74 | finally: |
| 75 | self._current_atom = previous_atom |
| 76 | |
| 77 | @classmethod |
| 78 | def get_instance(cls): |
no outgoing calls
no test coverage detected