Skip to content

Add permanent storage option for EventStream #1697

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

Merged
merged 32 commits into from
May 14, 2024
Merged

Add permanent storage option for EventStream #1697

merged 32 commits into from
May 14, 2024

Conversation

rbren
Copy link
Collaborator

@rbren rbren commented May 10, 2024

This allows EventStream to persist to a local or remote filesystem, instead of keeping all state in-memory.

This is helpful for a high-availability situation. For example, currently, if you rolled out a new deployment, any websockets would be disconnected, existing user sessions would be cancelled, and all the session data would be lost.

With this change, the client could reconnect to a new instance of the application, and the EventStore could rehydrate from persistent storage.

This change also factors action/observation/event serialization and deserialization into its own spot, to avoid circular imports

AWS_S3_ENDPOINT = 's3.amazonaws.com'


class S3FileStore(FileStore):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe put s3.py into a directory of cloud provider will be better, so we can add some other cloud file storage like azure bolb, Google Cloud Storage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree we'll probably add these in the future! Let's create a subdirectory then if we decide we need it

@assertion
Copy link
Contributor

@rbren I found this bug when opening two browsers and chat with opendevin at the same time, the bug related to EventStream.
pr: #1713

And I found you fixed it in current pr, but I suggest to merge mine pr before you finish current one.

@rbren
Copy link
Collaborator Author

rbren commented May 11, 2024

good catch @assertion!

@rbren rbren marked this pull request as ready for review May 13, 2024 16:10
Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 83.69565% with 45 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@755a407). Click here to learn what that means.

Files Patch % Lines
opendevin/server/agent/agent.py 0.00% 10 Missing ⚠️
opendevin/storage/s3.py 55.55% 8 Missing ⚠️
opendevin/events/serialization/event.py 85.71% 7 Missing ⚠️
opendevin/events/serialization/action.py 77.77% 6 Missing ⚠️
opendevin/storage/files.py 71.42% 4 Missing ⚠️
agenthub/dummy_agent/agent.py 33.33% 2 Missing ⚠️
opendevin/events/serialization/observation.py 91.66% 2 Missing ⚠️
opendevin/runtime/server/runtime.py 0.00% 2 Missing ⚠️
opendevin/storage/__init__.py 85.71% 2 Missing ⚠️
opendevin/controller/agent_controller.py 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1697   +/-   ##
=======================================
  Coverage        ?   61.37%           
=======================================
  Files           ?      108           
  Lines           ?     4241           
  Branches        ?        0           
=======================================
  Hits            ?     2603           
  Misses          ?     1638           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@enyst
Copy link
Collaborator

enyst commented May 14, 2024

I haven't got to test it, otherwise LGTM!

@rbren rbren merged commit dcb5d1c into main May 14, 2024
2 checks passed
@rbren rbren deleted the rb/perm-store branch May 14, 2024 15:09
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.

3 participants