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

allow custom redis client for a more flexible setup #1194

Closed
wants to merge 1 commit into from

Conversation

sheldonchiu
Copy link
Contributor

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

Allow users to bring their own Redis client if they need a more complex connection setup

self.state_manager.setup(state=self.state)

self.state_manager.setup(
state=self.state, redis_client=kwargs.get("redis_client", None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add the redis_client to the pcconfig instead? I think it makes more sense as a config field there.

Copy link
Contributor

@ozeranskii ozeranskii Jun 15, 2023

Choose a reason for hiding this comment

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

it may be a good idea to pass cache_client instead of redis_client . To get rid of the direct dependency on Redis and use any available cache server. For example: RedisCache , MemoryCache , DummyCache .

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes agreed, we should abstract that part out

Copy link
Contributor

Choose a reason for hiding this comment

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

I can finish this PR, if there are no objections. @picklelo @sheldonchiu

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can finish this PR, if there are no objections. @picklelo @sheldonchiu

sure, but my understand is that pcconfig should be a static setting, and adding this could break the init method

Copy link
Contributor

Choose a reason for hiding this comment

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

I can finish this PR, if there are no objections. @picklelo @sheldonchiu

sure, but my understand is that pcconfig should be a static setting, and adding this could break the init method

I'll think of a better way and propose a solution

Copy link
Contributor

@ozeranskii ozeranskii Sep 19, 2023

Choose a reason for hiding this comment

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

@picklelo, @masenf assign issue to me, please. Development is already underway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check #1676, there has been a major refactoring to how the StateManager works to accommodate alternative backing stores for state. Specifically, StateManager has become an abstract class with StateManagerMemory and StateManagerRedis implementing it. Also the redis implementation has moved to asyncio only to interop with the uvicorn ASGI server while providing non-blocking locking of state.

If you still want to work on this issue, highly advise to either wait till that PR merges, or base your work upon it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ozeranskii heads up that #1676 has merged to main.

Copy link
Contributor

Choose a reason for hiding this comment

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

@masenf it seems this PR is no longer relevant and can be closed?

@sheldonchiu sheldonchiu marked this pull request as draft June 22, 2023 13:40
@masenf
Copy link
Collaborator

masenf commented Oct 3, 2023

Closing PR. Future contributions in this area should focus on implementing a StateManager subclass that follows the necessary protocol.

@masenf masenf closed this Oct 3, 2023
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.

4 participants