-
Notifications
You must be signed in to change notification settings - Fork 36
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: odp segment manager #402
Conversation
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.
A few changes suggested.
…/python-sdk into mpirnovar/odp_segment_manager
@jaeopt Fixed your comments. Note that I will need to wait for Andy to merge OdpEventManager and then I will add couple of things to this PR -> refactor some tests and updated odp event. You can have another look now if you like, but I will ask to review again after I'm done with that change. |
@andrewleap-optimizely Got your changes in as well. Feel free to give feedback or wait until I make final changes to a few tests and odp event after the OdpEventManager merge. |
The suggested test changes blocked by |
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.
Looks really good! Just a couple little things
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.
Just a few more minor suggestions
self.logger.debug('ODP cache hit. Returning segments from cache.') | ||
return segments | ||
|
||
self.logger.debug('ODP cache miss. Making a call to ODP server.') |
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.
This is not necessarily a cache miss... We might want to split this into two debug logs
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.
@andrewleap-optimizely Not sure what you mean, can you clarify? If we don't hit the cache we miss it no?
U mean if we don't hit the cache there is the third option that is not a cache miss?
Rb segment manager has the same btw
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 mean that the cache might not have been checked, because ignore_cache
was set.
Yea I should change it in ruby and probably Java where I pulled it from 😀
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.
Something like this:
if not ignore_cache and not reset_cache:
segments = self.segments_cache.lookup(cache_key)
if segments:
self.logger.debug('ODP cache hit. Returning segments from cache.')
return segments
self.logger.debug('ODP cache miss.')
self.logger.debug('Making a call to ODP server.')
Otherwise looking at the logs with a disabled cache may confuse the reader into thinking the cache is being used.
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 see, yeah, that makes total sense. good catch
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.
LGTM with a nit. Can you remove "WIP" from the PR title?
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.
lgtm
Summary
Test plan
Issues