ipython_manager
Module Contents
Classes
Process objects represent activity that is run in a separate process |
|
An interactive IPython shell manager for code execution |
- class lagent.actions.ipython_manager.IPythonProcess(in_q, out_q, timeout=20, ci_lock=None, daemon=True)
Bases:
multiprocessing.ProcessProcess objects represent activity that is run in a separate process
The class is analogous to threading.Thread
- 参数:
in_q (multiprocessing.Queue) –
out_q (multiprocessing.Queue) –
timeout (int) –
ci_lock (str) –
daemon (bool) –
- in_q
- out_q
- timeout = 20
- session_id2shell
- ci_lock
- run()
Method to be run in sub-process; can be overridden in sub-class
- exec(session_id, code)
- static create_shell(enable_history=False, in_memory=True)
- 参数:
enable_history (bool) –
in_memory (bool) –
- static extract_code(text)
Extract Python code from markup languages.
- 参数:
text (
str) – Markdown-formatted text- 返回:
Python code
- 返回类型:
str
- class lagent.actions.ipython_manager.IPythonInteractiveManager(max_workers=50, timeout=20, ci_lock=None, description=None, parser=JsonParser)
Bases:
lagent.actions.base_action.BaseActionAn interactive IPython shell manager for code execution
- 参数:
max_workers (int) –
timeout (int) –
ci_lock (str) –
description (Optional[dict]) –
parser (Type[lagent.actions.parser.BaseParser]) –
- max_workers = 50
- timeout = 20
- ci_lock = None
- id2queue
- id2process
- out_queue
- process_code(index, session_id, code)
- run_code_blocks(session_code_pairs)
- clear()
- reset()