(engine: ExecutionEngine, isMachineOutput: boolean)
| 977 | } |
| 978 | |
| 979 | async function startExecutionEngine(engine: ExecutionEngine, isMachineOutput: boolean): Promise<void> { |
| 980 | if (!isMachineOutput) { |
| 981 | log(getChalk().dim('Starting deepnote-toolkit server...')) |
| 982 | } |
| 983 | |
| 984 | try { |
| 985 | await engine.start() |
| 986 | } catch (error) { |
| 987 | const message = error instanceof Error ? error.message : String(error) |
| 988 | |
| 989 | // Attempt to clean up any partially-initialized resource |
| 990 | try { |
| 991 | await engine.stop() |
| 992 | } catch (stopError) { |
| 993 | const stopMessage = stopError instanceof Error ? stopError.message : String(stopError) |
| 994 | if (!isMachineOutput) { |
| 995 | logError(getChalk().dim(`Note: cleanup also failed: ${stopMessage}`)) |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | throw new Error( |
| 1000 | `Failed to start server: ${message}\n\nMake sure deepnote-toolkit is installed:\n pip install deepnote-toolkit[server]` |
| 1001 | ) |
| 1002 | } |
| 1003 | |
| 1004 | if (!isMachineOutput) { |
| 1005 | log(getChalk().dim('Server ready. Executing blocks...\n')) |
| 1006 | } |
| 1007 | } |
| 1008 | |
| 1009 | async function startMetricsMonitoring( |
| 1010 | engine: ExecutionEngine, |
no test coverage detected