-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Invalid execution window when in Schedule when start > end #3321
Copy link
Copy link
Closed
Description
When creating a Schedule with start > end, the EventGenerator still executes once at the start time and then deactivates, which results in an invalid configuration of the execution window.
Example:
Schedule(interval=1.0, start=10, end=5)This configuration logically defines an empty execution window, but the current behavior allows the event to execute at t=10 and then stop, which doesn’t make sense in this context.
Expected Behavior:
A ValueError should be raised during the creation of the Schedule in __post_init__ if start > end, as this represents an invalid time window.
Proposed Fix:
Validate the start and end parameters during initialization in the Schedule class:
if self.start is not None and self.end is not None:
if self.start > self.end:
raise ValueError(f"Schedule start ({self.start}) cannot be after end ({self.end})")This change would enforce the expected behavior and prevent scheduling events with logically invalid times.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels