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

Method start

preswald/engine/runner.py:75–103  ·  view source on GitHub ↗

Start running the script with enhanced validation. Args: script_path: Path to the script file to run

(self, script_path: str)

Source from the content-addressed store, hash-verified

73 return self._state == ScriptState.RUNNING
74
75 async def start(self, script_path: str):
76 """Start running the script with enhanced validation.
77
78 Args:
79 script_path: Path to the script file to run
80 """
81 script_file = Path(script_path)
82 if not script_file.exists():
83 error_msg = f"Script file not found: {script_path}"
84 logger.error(f"[ScriptRunner] {error_msg}")
85 await self._send_error(error_msg)
86 return
87
88 logger.info(f"[ScriptRunner] Starting execution: {script_path}")
89 with self._lock:
90 self.script_path = script_path
91 self._state = ScriptState.RUNNING
92 self._run_count = 0
93
94 if reactivity_explicitly_disabled():
95 self._service.disable_reactivity()
96 else:
97 logger.info("[ScriptRunner] Reactivity is disabled by configuration")
98
99 try:
100 await self.run_script()
101 except Exception as e:
102 await self._send_error(f"Failed to start script: {e!s}")
103 self._state = ScriptState.ERROR
104
105 async def stop(self):
106 """Stop the script and clean up resources."""

Callers 2

run_scriptFunction · 0.80

Calls 4

_send_errorMethod · 0.95
run_scriptMethod · 0.95
disable_reactivityMethod · 0.80

Tested by

no test coverage detected