Skip to content
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

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

KaspariK
Copy link
Member

@KaspariK KaspariK commented Oct 31, 2024

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.

Copy link
Member

@nemacysts nemacysts left a 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

Comment on lines 763 to 765
"retries_delay": state_data["retries_delay"].total_seconds()
if state_data["retries_delay"]
else None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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 :)

Copy link
Member Author

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.

@KaspariK KaspariK merged commit 5debd34 into master Oct 31, 2024
4 checks passed
@@ -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')}")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants