I have a question related to the Schedules and Prefect UI Scheduler. Can I use the Prefect Schedule to schedule a task in the prefect UI:
I want to schedule the below code in the Prefect UI.
from prefect import task, Flow
from datetime import timedelta
#from prefect.schedules import IntervalSchedule
from prefect.schedules import Schedule
from prefect.schedules.clocks import IntervalClock
import pendulum
from prefect.engine.executors import LocalDaskExecutor
from prefect.engine.executors import DaskExecutor
import prefect
import boto3
@task
def say_hello():
print("Hello, world!")
logger = prefect.context.get("logger")
logger.info("Hello, world!")
try:
s3 = boto3.resource('s3')
except Exception as e:
raise signals.FAIL(e)
if
name == '__main__':
schedule = Schedule(clocks=[IntervalClock(start_date=pendulum.datetime(2020, 12, 21,hour=6,minute=3,second=0),interval=timedelta(minutes=2))])
with Flow("Hello") as flow:
say_hello()
executor=LocalDaskExecutor(scheduler="processes", num_workers=6)
flow.run(executor=executor)
flow.register(project_name="Hello, World!")