Skip to content

Commit

Permalink
Add description to invariant check (#12496)
Browse files Browse the repository at this point in the history
### Summary & Motivation
Previously this invariant check doesn't have a description so the error
is confusing. Adding a description to make it more clear.

### How I Tested These Changes
```
make black
python -m pytest python_modules/dagster/dagster_tests
```

---------

Co-authored-by: Sean Han <xhan1@flexport.com>
  • Loading branch information
CodeMySky and Sean Han committed Feb 24, 2023
1 parent 102c0bc commit a3b7dfc
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -159,7 +159,10 @@ def _map_partitions(
to_partitions_def = cast(TimeWindowPartitionsDefinition, to_partitions_def)

if start_offset != 0 or end_offset != 0:
check.invariant(from_partitions_def.cron_schedule == to_partitions_def.cron_schedule)
check.invariant(
from_partitions_def.cron_schedule == to_partitions_def.cron_schedule,
"Offset can't be used when cron schedules don't match",
)

if to_partitions_def.timezone != from_partitions_def.timezone:
raise DagsterInvalidDefinitionError("Timezones don't match")
Expand Down

0 comments on commit a3b7dfc

Please sign in to comment.