-
Notifications
You must be signed in to change notification settings - Fork 94
Flow registration with unaltered scheduled status #208
Description
Current behavior
When registering a Flow, the set_schedule_active argument of the prefect.core.flow.Flow.register method determines whether the flow's new version is automatically enabled or disabled depending on its value (True or False, respectively).
This effectively overrides any current schedule setup.
For instance, if a flow's scheduled status is "active" and the set_schedule_active argument is set to False when a new version of the flow is registered, the flow's scheduled status will be forced to "inactive".
Proposed behavior
There should be an option to leave the scheduled status unchanged, meaning that if the flow is active/inactive, the new registration should leave the new flow as active/inactive as well.
This will help avoid 2 potentially dangerous situations:
- Accidentally enabling a flow that should remain disabled
- Accidentally disabling a flow that should remain enabled
A suggestion is to have this behaviour whenever the set_schedule_active argument is given a value of None. This would need to be explicit though, given that the current default value of the set_schedule_active argument is True, and changing that default value to None will break backwards compatibility.
More context can be found in this Slack thread.
Example
Flow Currently Active
These will leave the status as "active":
flow.register()
flow.register(set_schedule_active=True)
flow.register(set_schedule_active=None)These will set the status to "inactive"
flow.register(set_schedule_active=False)Flow Currently Inactive
These will leave the status as "inactive":
flow.register(set_schedule_active=False)
flow.register(set_schedule_active=None)These will set the status to "active"
flow.register()
flow.register(set_schedule_active=True)