-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Feat: Stop runtimes rather than delete them #6403
Conversation
for exposed_port in config['ExposedPorts'].keys(): | ||
exposed_port = int(exposed_port.split('/tcp')[0]) | ||
if exposed_port != self._host_port and exposed_port != self._vscode_port: | ||
self._app_ports.append(exposed_port) |
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.
I had to change this logic because the existing logic did not work for stopped containers.
@@ -227,6 +228,8 @@ async def delete_conversation( | |||
is_running = await session_manager.is_agent_loop_running(conversation_id) | |||
if is_running: | |||
await session_manager.close_session(conversation_id) | |||
runtime_cls = get_runtime_cls(config.runtime) | |||
await runtime_cls.delete(conversation_id) |
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.
Explicitly allow the runtime to run delete logic here.
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.
Two issues I'm noticing:
- When I start a fourth conversation, the newest docker instance goes down, instead of the oldest
- When I resume an old conversation, it doesn't seem to respect the max of 3 running docker instances
As noted on the call yesterday, the oldest conversation should now be the one that gets stopped, and the limitation of 3 instances is in place, but the conversation panel does not update in real time. |
End-user friendly description of the problem this fixes or functionality that this introduces
Improved container management: Runtime containers are now stopped instead of deleted when not in use, allowing for faster reuse and better resource management. Containers are only deleted when a conversation is explicitly deleted.
Give a summary of what the PR does, explaining any non-trivial design decisions
This change improves how OpenHands handles runtime containers by stopping them instead of deleting them when they are no longer needed. This allows for faster container reuse and better resource management.
This PR changes how runtime containers are handled in OpenHands:
Design decisions:
Screenshots
2 Stopped Conversations
Restart a conversation
Link of any specific issues this addresses
N/A
To run this PR locally, use the following command: