Skip to content
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

Restart Jupyter kernel if package is installed via bash too #3178

Closed
wants to merge 4 commits into from

Conversation

SmartManoj
Copy link
Contributor

@SmartManoj SmartManoj commented Jul 30, 2024

What is the problem that this fixes or functionality that this introduces? Does it fix any open issues?

This PR introduces functionality to restart the Jupyter kernel if a package is installed via bash commands. It addresses issues with kernel state management that arise when new packages are installed via bash, ensuring that changes are correctly reflected without manual intervention.


Give a summary of what the PR does, explaining any non-trivial design decisions

This PR refactors the ServerRuntime class to handle kernel restarts more effectively. Key changes include:

  1. Kernel Restart Logic: Added a restart_kernel method to restart the Jupyter kernel and ensure that it is re-initialized with necessary code.
  2. Parsing Pip Output: Added a parse_pip_output method to handle package installation messages and determine if a kernel restart is needed based on the output of pip install commands.
  3. Removed Redundant Code: Moved kernel_init_code to restart_kernel method and removed unused kernel_init_code attributes from action parser classes (CodeActActionParserIPythonRunCell and CodeActSWEActionParserIPythonRunCell).

These changes ensure that kernel restarts and re-initializations are handled automatically, improving the reliability of the development environment.


Other references

Event history of ollama/llama3


@rbren
Copy link
Collaborator

rbren commented Jul 30, 2024

We're doing some cleanup of PRs, and are going to close this one for now.

@rbren rbren closed this Jul 30, 2024
SmartManoj added a commit to SmartManoj/Kevin that referenced this pull request Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants