-
Notifications
You must be signed in to change notification settings - Fork 63
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
Use total_seconds for timedeltas. Log job and jobrun names/runnums on serialization #1004
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.
i think it's fine to have multiple patch releases - it'll make it easier to track the impact of changes while we iterate in non-prod
tron/core/actionrun.py
Outdated
"retries_delay": state_data["retries_delay"].total_seconds() | ||
if state_data["retries_delay"] | ||
else None, |
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.
"retries_delay": state_data["retries_delay"].total_seconds() | |
if state_data["retries_delay"] | |
else None, | |
"retries_delay": state_data["retries_delay"].total_seconds() | |
if state_data["retries_delay"] is not None | |
else None, |
i think we'd want something like the above - unless there's no difference between None and 0 when deserializing back into a timedelta later :)
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.
Ah, true. I think it's ultimately the same in restart, but there is indeed a semantic difference.
@@ -204,8 +204,10 @@ def get_type_from_key(self, key: str) -> str: | |||
def _serialize_item(self, key: Literal[runstate.JOB_STATE, runstate.JOB_RUN_STATE], state: Dict[str, Any]) -> Optional[str]: # type: ignore | |||
try: | |||
if key == runstate.JOB_STATE: | |||
log.info(f"Serializing Job: {state.get('job_name')}") |
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.
I think total_seconds is the easiest to convert back to timedelta later. I added some logging that might be noisier than we want longterm, but should make debugging these a lot easier.
Recreated the errors in infrastage and this does appear to resolve things.
Sidenote, I'm happy to leave this unmerged while doing more testing in dev/stage to maybe minimize the number of patch releases.