MCPcopy
hub / github.com/StructuredLabs/preswald / active_atom

Method active_atom

preswald/engine/base_service.py:57–75  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 4

wrapperFunction · 0.80
rerunMethod · 0.80
run_scriptMethod · 0.80
_execute_atomMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected