Skip to content

Commit a11e179

Browse files
authored
Merge pull request #54 from Misakar-0v0/main
fix: error caused by the repeated Destroy
2 parents 71254dd + 4f90985 commit a11e179

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

ghostos/core/aifunc/executor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def destroy(self) -> None:
180180
# not every submanager is created at self.execute,
181181
# so they could be destroyed outside already
182182
return
183+
self._destroyed = True
183184
del self._container
184185
del self._values
185186
del self._exec_step

ghostos/prototypes/ghostfunc/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,7 @@ def _save_thread(self, thread: GoThreadInfo) -> None:
291291
self._cache.threads[self._target_qualname] = thread
292292

293293
def destroy(self) -> None:
294-
del self._cache
295-
del self._container
294+
if hasattr(self, '_cache'):
295+
del self._cache
296+
if hasattr(self, '_container'):
297+
del self._container

ghostos/scripts/cli/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,13 @@ def _get_command_line_as_string() -> str | None:
162162
cmd_line_as_list = [parent.command_path]
163163
cmd_line_as_list.extend(sys.argv[1:])
164164
return subprocess.list2cmdline(cmd_line_as_list)
165+
166+
167+
if __name__ == '__main__':
168+
# 方便通过IDE调试
169+
from ghostos.scripts.cli.run_streamlit_app import start_ghost_app
170+
from ghostos.scripts.cli.utils import find_ghost_by_file_or_module
171+
172+
python_file_or_module = "ghostos.demo.ghost_func_example"
173+
ghost_info, module, filename, is_temp = find_ghost_by_file_or_module(python_file_or_module)
174+
start_ghost_app(ghost_info, module.__name__, filename, is_temp)

0 commit comments

Comments
 (0)