https://prefect.io logo
z

Zhibin Dai

06/01/2022, 4:13 PM
Hi team, we are facing an odd issue with scheduling flows. We have a python script that schedules flows. When the script gets run, it duplicates the schedule for one particular flow, for the next day. For example, if there is a flow scheduled for 1 am tomorrow, when we re-run the build_flows script, it will create another flow for that same time the next day, but not any subsequent days
this is the code snippet for the scheduler
Copy code
if flow.name == 'ppi_parent_flow':
            clocks = []
            for prop_source, prop_source_config in US_PROPERTIES_CONFIG_MAP.items():
                clock = CronClock(cron=prop_source_config['schedule'], parameter_defaults={
                    PREFECT_DATASET_PARAM_NAME: prop_source, PREFECT_RUN_ENVIRONMENT_PARAM_NAME: run_env})
                clocks.append(clock)
            schedule = Schedule(clocks=clocks)
            flow.schedule = schedule
this is an example config with all the schedules
Copy code
US_PROPERTIES_CONFIG_MAP = {
    'DATASET': {
        'schedule': '0 5 * * 1-5'
    }
}
any help is appreciated, thanks!
k

Kevin Kho

06/01/2022, 4:35 PM
Do you have a schedule that was configured through the UI?
z

Zhibin Dai

06/01/2022, 4:37 PM
no it should all be through the API
k

Kevin Kho

06/01/2022, 4:40 PM
I can’t immediately see anything wrong
z

Zhibin Dai

06/02/2022, 1:33 PM
@Kevin Kho for the clock schedule, is there a parameter to make it overwrite existing schedules, or something like that?
k

Kevin Kho

06/02/2022, 2:33 PM
flow registration will always overwrite the existing schedule
3 Views