-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fix ConsoleMessage Datetime for betterproto 2.0.0b7 #2815
Merged
Merged
Conversation
This file contains 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
Yicong-Huang
requested changes
Sep 3, 2024
core/amber/src/main/python/core/util/console_message/replace_print.py
Outdated
Show resolved
Hide resolved
bobbai00
force-pushed
the
jiadong-fix-py-console-message-timestamp
branch
from
September 3, 2024 14:55
8ffa1f9
to
79ed97e
Compare
Yicong-Huang
approved these changes
Sep 4, 2024
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!
@bobbai00 please make sure you update the PR description accordingly. |
PurelyBlank
pushed a commit
that referenced
this pull request
Dec 4, 2024
This PR fixes the error of python udf stuck when betterproto is at version `2.0.0b7` This fix is compatible with betterproto `2.0.0b3` to `2.0.0b7`. ## The cause of the bug When betterproto is at version `2.0.0b7`, timestamp requires the timezone information. Otherwise, there will be exceptions if `print` statements are in the python udf's code. Before the fix, here is the code snippet of creating `ConsoleMessage` in `pytexera`: ```python ConsoleMessage( worker_id=self.context.worker_id, timestamp=datetime.datetime.now(), msg_type=ConsoleMessageType.DEBUGGER, source="(Pdb)", title=debug_event, message="", ) ``` ## How the fix is done By changing the `timestamp=datetime.datetime.now()` to `timestamp=datetime.datetime.now(datetime.timezone.utc)` in all occurrence of `ConsoleMessage` constructor, i.e. in `replace_print.py`, `data_processor.py` and `main_loop.py`. This problem got fixed.
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 PR fixes the error of python udf stuck when betterproto is at version
2.0.0b7
This fix is compatible with betterproto
2.0.0b3
to2.0.0b7
.The cause of the bug
When betterproto is at version
2.0.0b7
, timestamp requires the timezone information. Otherwise, there will be exceptions ifprint
statements are in the python udf's code.Before the fix, here is the code snippet of creating
ConsoleMessage
inpytexera
:How the fix is done
By changing the
timestamp=datetime.datetime.now()
totimestamp=datetime.datetime.now(datetime.timezone.utc)
in all occurrence ofConsoleMessage
constructor, i.e. inreplace_print.py
,data_processor.py
andmain_loop.py
. This problem got fixed.A unit test is added
A unit test to test the serialization/deserialization of the console message is added.