Repository navigation
Enhancements to the interface and bugfixes - #37
Merged
Merged
Conversation
To properly convert from protobuf to datetime, one has to explicitly
handle the nanoseconds like so:
```python
# Add microseconds and add nanoseconds converted to microseconds
microseconds = int(ts.nanos / 1000)
return datetime.fromtimestamp(ts.seconds + microseconds * 1e-6,
tz=tz)
```
We implemented a convert function that does exactly this, but we have
not been using it consistently yet. This commit replaces the last
occurances.
With that in mind, this commit changes:
* Consistently use the conversion function from the common repository
Fix start_time conversion imprecision bug
* Use shorter notations to set timezones
* Raise on invalid timezone in create()
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Makes it easier to handle & compare the request object with a dispatch object, also adds more consistency overall. Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Some tests require extra checks to not rely on the order. Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Round start_time seconds to have the same behavior as the gRPC server frequenz-io/frequenz-service-dispatch#77 Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
There is hardly any use-case for wanting to use `create()` and not have the new dispatch available. This is also in anticipation of the upcoming server-side feature that will return the newly created dispatch. Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
ktickner
approved these changes
Apr 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is identical with #33
It was re-opened due to bugs in github, but was reviewed by luca and sahas