-
Notifications
You must be signed in to change notification settings - Fork 59
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
vdk-heartbeat: null datetime conversion fix #813
Conversation
We've noticed an occasional error occurs, applying the stack trace: File "/opt/buildenv/lib/python3.7/site-packages/vdk/internal/heartbeat/ job_controller.py", line 383, in check_job_execution_finished self._datetime_from_iso_format(str(e["end_time"])) for e in execution_list TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime' The error seems to reproduce in case execution end_time is not yet populated, and `max()` is attempting to compare datetime with NoneType. The fix includes filtering out any empty end_times, so that we rely on statuses and end_times populated only. A broader Exception is added for handling during datetime conversion, like a preventive step. Testing done: did retrieve the Execution API response, did reproduce same TypeError error via local code snippet, then verified the newly introduced fix applied is operational. Signed-off-by: ikoleva <[email protected]>
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
We've noticed an occasional error occurs, applying the stack trace: File "/opt/buildenv/lib/python3.7/site-packages/vdk/internal/heartbeat/ job_controller.py", line 383, in check_job_execution_finished self._datetime_from_iso_format(str(e["end_time"])) for e in execution_list TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime' The error seems to reproduce in case execution end_time is not yet populated, and `max()` is attempting to compare datetime with NoneType. The fix includes filtering out any empty end_times, so that we rely on statuses and end_times populated only. A broader Exception is added for handling during datetime conversion, like a preventive step. Testing done: did retrieve the Execution API response, did reproduce same TypeError error via local code snippet, then verified the newly introduced fix applied is operational. Signed-off-by: ikoleva <[email protected]>
We've noticed an occasional error occurs, applying the stack trace: File "/opt/buildenv/lib/python3.7/site-packages/vdk/internal/heartbeat/ job_controller.py", line 383, in check_job_execution_finished self._datetime_from_iso_format(str(e["end_time"])) for e in execution_list TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime' The error seems to reproduce in case execution end_time is not yet populated, and `max()` is attempting to compare datetime with NoneType. The fix includes filtering out any empty end_times, so that we rely on statuses and end_times populated only. A broader Exception is added for handling during datetime conversion, like a preventive step. Testing done: did retrieve the Execution API response, did reproduce same TypeError error via local code snippet, then verified the newly introduced fix applied is operational. Signed-off-by: ikoleva <[email protected]>
Please add a unit test. It's a good idea to add a test(s) that verifies the bug is fixed (they should fail without the fix) -this way |
We have a unit test, that failed - so I did rework and document the workflow considered, Or do you have something else in mind? |
We've noticed an occasional error occurs, applying the stack trace: File "/opt/buildenv/lib/python3.7/site-packages/vdk/internal/heartbeat/ job_controller.py", line 383, in check_job_execution_finished self._datetime_from_iso_format(str(e["end_time"])) for e in execution_list TypeError: '>' not supported between instances of 'NoneType' and 'datetime.datetime' The error seems to reproduce in case execution end_time is not yet populated, and `max()` is attempting to compare datetime with NoneType. The fix presumes the status of latest non-populated `end_time` is freshest, so returns that if present. Otherwise, returns status of latest end datetime populated. Discussion on workflow is found at #813 #discussion_r854317775 A broader Exception is added for handling during datetime conversion, like a preventive step. Testing done: did retrieve the Execution API response, did reproduce same TypeError error via local code snippet, then verified the newly introduced fix applied is operational. Did add a unit test to cover this use-case. Signed-off-by: ikoleva <[email protected]>
We've noticed an occasional error occurs, applying the stack trace:
File "/opt/buildenv/lib/python3.7/site-packages/vdk/internal/heartbeat/
job_controller.py", line 383, in check_job_execution_finished
self._datetime_from_iso_format(str(e["end_time"])) for e in
execution_list
TypeError: '>' not supported between instances of 'NoneType' and
'datetime.datetime'
The error seems to reproduce in case execution end_time is not yet
populated, and
max()
is attempting to compare datetime with NoneType.The fix presumes the status of latest non-populated
end_time
isfreshest, so returns that if present. Otherwise, returns status of
latest end datetime populated. Discussion on workflow is found at
#813 (comment)
A broader Exception is added for handling during datetime conversion,
like a preventive step.
Testing done: did retrieve the Execution API response, did reproduce
same TypeError error via local code snippet, then verified the newly
introduced fix applied is operational. Did add a unit test to cover
this use-case.
Signed-off-by: ikoleva [email protected]