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
Add ability to use timedelta and stings to start_time
and end_time
.
#8348
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.
LGTM 👍
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 👍
ttl: float | timedelta | str | None, *, coerce_none_to_inf: bool = True | ||
) -> float | None: | ||
""" | ||
Convert a ttl value to a float representing "number of seconds". |
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.
nit: should we rename ttl
here to duration
to better match the new function name?
ttl: float | timedelta | str | None, *, coerce_none_to_inf: bool = True | |
) -> float | None: | |
""" | |
Convert a ttl value to a float representing "number of seconds". | |
duration: float | timedelta | str | None, *, coerce_none_to_inf: bool = True | |
) -> float | None: | |
""" | |
Convert a duration value to a float representing "number of seconds". |
def __init__(self, duration: str): | ||
MarkdownFormattedException.__init__( | ||
self, | ||
"TTL string doesn't look right. It should be formatted as" |
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.
nit: Should it be TTL
here or Duration or something more neutral?
I just saw that the fragment PR also refactors this function into a more general version:
|
@LukasMasuch discussed this with Vincent, I added todos to replace the function with |
Describe your changes
Add the ability to use time delta and stings to start_time and end_time.
Also moved
ttl_to_seconds
function out of cache_utils toruntime_utils
and renamed it toduration_to_seconds
, since now it is also used outside of the cache module.GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.