-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: timeout for interpreter module #1851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Wendong-Fan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @lqjack 's contribution and sorry for the late review, could you also helping update the docstring? Thanks in advance!
| require_confirm: bool = True, | ||
| print_stdout: bool = False, | ||
| print_stderr: bool = True, | ||
| default_timeout: int = 60, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also update the docstring?
|
|
||
| @abstractmethod | ||
| def run(self, code: str, code_type: str) -> str: | ||
| def run(self, code: str, code_type: str, timeout: int = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to update the docstring
| self, | ||
| file: Path, | ||
| code_type: str, | ||
| timeout: int = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Optional[int] in the type hints for clarity.
| self.default_timeout = default_timeout | ||
|
|
||
| def run(self, code: str, code_type: str) -> str: | ||
| def run(self, code: str, code_type: str, timeout:int =None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Optional[int] in the type hints for clarity.
| self, | ||
| code: str, | ||
| code_type: str, | ||
| timeout: int = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Optional[int] in the type hints for clarity.
| self, | ||
| file: Path, | ||
| code_type: str, | ||
| timeout: int = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Optional[int] in the type hints for clarity.
|
|
||
| @abstractmethod | ||
| def run(self, code: str, code_type: str) -> str: | ||
| def run(self, code: str, code_type: str, timeout: int = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer Optional[int] in the type hints for clarity.
|
|
||
| @abstractmethod | ||
| def run(self, code: str, code_type: str) -> str: | ||
| def run(self, code: str, code_type: str, timeout: int = None) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to update the argument timeout: Optional[int] = None in the def run of all of the subclasses if you are updating this parameter in the base class. You have not updated it in e2b_interpreter.py and subprocess_interpreter.py
Description
add timeout support for interpreter module
Checklist
Go over all the following points, and put an
xin all the boxes that apply.Fixes #issue-numberin the PR description (required)pyproject.tomlanduv lockIf you are unsure about any of these, don't hesitate to ask. We are here to help!