https://prefect.io logo
m

minhtuan

08/05/2022, 3:11 AM
Hi everyone, I'm trying to create a schedule task in a newest version but it seem didn't work. Anyone can help me because I was reading docs so many times but I couldn't find a way.
Version: 2.0.3
from prefect.schedules import IntervalSchedule
ModuleNotFoundError: No module named 'prefect.schedules'
c

Cole Murray

08/05/2022, 3:37 AM
Schedule related can be found under the
prefect.orion.schemas.schedules
import e.g.
Copy code
from prefect.orion.schemas.schedules import CronSchedule, IntervalSchedule
https://github.com/PrefectHQ/prefect/blob/main/src/prefect/orion/schemas/schedules.py
❤️ 1
m

minhtuan

08/05/2022, 7:05 AM
thank you, but I got another issue. Is there
SubprocessFlowRunner
available on
flow_runner
? I was try schedule this but nothing has happended.
Copy code
from prefect.orion.schemas.schedules import IntervalSchedule
from prefect.orion.schemas.actions import DeploymentCreate
#from prefect.flow_runner import SubprocessFlowRunner 
from datetime import timedelta 

DeploymentCreate( 
    flow_id = '777eaa91-aaaa-451a-bcbf',
    name='model_training,',
    schedule=IntervalSchedule(interval=timedelta(minutes=10)),
    is_schedule_active=  True,
   # flow_runner = SubprocessFlowRunner(),
    tags = ["ml"],
    manifest_path = '/home/tuannm/Desktop/prefect_deploy-manifest.json'
)
j

Jeff Hale

08/05/2022, 11:27 AM
Hi @minhtuan That’s the link to the internal code for schedules. To create a schedule with Python 2.0, you can use the GUI or edit the deployment.yaml file. I explain how in the Scheduling section of the Getting Started Guide. We’ll also be updating the docs soon.
k

Khuyen Tran

08/05/2022, 2:57 PM

This video

explains how you can schedule in 2.0
4 Views