Skip to content

Conversation

@lqjack
Copy link
Contributor

@lqjack lqjack commented Mar 14, 2025

Description

add timeout support for interpreter module

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed:
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

Copy link
Member

@Wendong-Fan Wendong-Fan left a 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,
Copy link
Member

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:
Copy link
Member

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

@Wendong-Fan Wendong-Fan changed the title timeout for interpreter module feat: timeout for interpreter module Mar 18, 2025
@Wendong-Fan Wendong-Fan added the enhancement New feature or request label Mar 18, 2025
@Wendong-Fan Wendong-Fan added this to the Sprint 25 milestone Mar 18, 2025
self,
file: Path,
code_type: str,
timeout: int = None
Copy link
Collaborator

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:
Copy link
Collaborator

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,
Copy link
Collaborator

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,
Copy link
Collaborator

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:
Copy link
Collaborator

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:
Copy link
Collaborator

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

@Wendong-Fan Wendong-Fan linked an issue Mar 24, 2025 that may be closed by this pull request
2 tasks
@Wendong-Fan Wendong-Fan modified the milestones: Sprint 25, Sprint 48 Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Feature Request] Provide interpreter timeout support

3 participants