Schedules hotfix for DTS dashboard#169
Open
andystaples wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the durabletask.scheduled persisted schedule entity JSON shape to match what the Durable Task Scheduler (DTS) dashboard expects when deserializing state as .NET types.
Changes:
- Serialize
ScheduleConfigurationusing PascalCase property names and formatintervalas a .NETTimeSpanstring. - Serialize
ScheduleState.statusas the .NET enum ordinal (int) and accept legacy string/snake_case formats when reading. - Add regression tests for the .NET-compatible JSON shape and update the changelog with the user-visible fix.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/durabletask/scheduled/test_models.py | Adds tests validating .NET-compatible JSON serialization and legacy deserialization support. |
| durabletask/scheduled/schedule_status.py | Adds helpers to convert schedule status to/from .NET ordinal/string representations. |
| durabletask/scheduled/models.py | Implements PascalCase JSON shape, TimeSpan interval formatting/parsing, and more tolerant deserialization. |
| CHANGELOG.md | Documents the dashboard compatibility fix under ## Unreleased. |
| # .NET serializes ``DateTimeOffset`` with a numeric offset, but tolerate a | ||
| # trailing ``Z`` so states written by other producers still parse on the | ||
| # Python versions that predate ``fromisoformat`` accepting ``Z``. | ||
| return datetime.fromisoformat(value.replace("Z", "+00:00")) |
| return _STATUS_TO_ORDINAL[self] | ||
|
|
||
| @classmethod | ||
| def from_dotnet(cls, value: Union[int, str, None]) -> "ScheduleStatus": |
Comment on lines
4
to
6
| from enum import Enum | ||
| from typing import Union | ||
|
|
| state.schedule_last_modified_at = _from_iso(data.get("schedule_last_modified_at")) | ||
| config_data = data.get("schedule_configuration") | ||
| state.status = ScheduleStatus.from_dotnet(_get(data, "Status", "status")) | ||
| state.execution_token = _get(data, "ExecutionToken", "execution_token") |
This file contains hidden or 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
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.
Fixes the over-the-wire shape for schedules objects to comply with the expected shape from the DTS backend/dotnet
Fixes: