-
Notifications
You must be signed in to change notification settings - Fork 114
Log when duration of forward model step is negative #10264
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -69,6 +69,8 @@ | |||||||||||||||||||||
state.COLOR_NOT_ACTIVE: QColor(*state.COLOR_NOT_ACTIVE), | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
_warn_once = True | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
def _estimate_duration( | ||||||||||||||||||||||
start_time: datetime, end_time: datetime | None = None | ||||||||||||||||||||||
|
@@ -429,6 +431,16 @@ def _fm_step_data( | |||||||||||||||||||||
) | ||||||||||||||||||||||
# There is no method for truncating microseconds, so we remove them | ||||||||||||||||||||||
delta -= timedelta(microseconds=delta.microseconds) | ||||||||||||||||||||||
if delta < timedelta(): | ||||||||||||||||||||||
global _warn_once # noqa: PLW0603 | ||||||||||||||||||||||
if _warn_once: | ||||||||||||||||||||||
_warn_once = False | ||||||||||||||||||||||
logger.warning( | ||||||||||||||||||||||
"Negative duration in snapshot encountered. " | ||||||||||||||||||||||
f"start_time={start_time} end_time={node.data.get(ids.END_TIME)} " | ||||||||||||||||||||||
f"delta={delta}" | ||||||||||||||||||||||
) | ||||||||||||||||||||||
Comment on lines
+438
to
+442
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @xjules showed me a trick in 2023, and now I am showing it to you =)
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this instance it is not that useful. f"{object=} gives object.__repr__ while I want object.__str__ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get why this shouldn't work @JHolba ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it works, but you get different text. I want this representation: you can try this in a repl from datetime import datetime
start = datetime.now()
print("print using {start=}: " f"{start=}")
print("print using start={start}: " f"start={start}") |
||||||||||||||||||||||
delta = timedelta() | ||||||||||||||||||||||
return str(delta) | ||||||||||||||||||||||
|
||||||||||||||||||||||
return node.data.get(data_name) | ||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.