Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved the scheduled workflows examples to core #413

Merged
merged 4 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cookbook/core/scheduled_workflows/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _scheduled_workflows:

Scheduling Workflows
--------------------

This module explains on how to create and launch scheduled workflows in flyte
Flyte supports both cron based and fixed rate schedules.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""
Scheduling Workflows
--------------------

For background on launch plans, refer to :any:`launch_plans`.

Launch plans can be set to run automatically on a schedule if the Flyte platform is properly configured.
For workflows that depend on knowing the kick-off time, Flyte also supports passing in the scheduled time (not the actual time, which may be a few seconds off) as an argument to the workflow.
"""
Expand Down Expand Up @@ -32,8 +30,8 @@ def date_formatter_wf(kickoff_time: datetime):
# Cron Schedules
# ##############
#
# Cron expression strings use the `AWS syntax <http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions>`_.
# These are validated at launch plan registration time.
# Cron expression strings use the following `syntax <https://pkg.go.dev/github.com/robfig/cron#hdr-CRON_Expression_Format>`_.
# An incorrect cron schedule expression would lead to failure in triggering the schedule
from flytekit import CronSchedule, LaunchPlan

# creates a launch plan that runs at 10am UTC every day.
Expand All @@ -42,7 +40,9 @@ def date_formatter_wf(kickoff_time: datetime):
workflow=date_formatter_wf,
schedule=CronSchedule(
# Note that kickoff_time_input_arg matches the workflow input we defined above: kickoff_time
cron_expression="0 10 * * ? *",
# Native scheduler doesn't support `AWS syntax <http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions>`_.
pmahindrakar-oss marked this conversation as resolved.
Show resolved Hide resolved
# But in case you are using the AWS scheme of schedules and not using the native scheduler then switch over the schedule parameter with cron_expression
schedule="*/1 * * * *", # Following schedule runs every min
kickoff_time_input_arg="kickoff_time",
),
)
Expand Down
4 changes: 3 additions & 1 deletion cookbook/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class CustomSorter(FileNameSortKey):
"typed_schema.py",
"custom_objects.py",
"enums.py",
"lp_schedules.py",
# Testing
"mocking.py",
# Containerization
Expand All @@ -74,7 +75,6 @@ class CustomSorter(FileNameSortKey):
# Deployment
## Workflow
"deploying_workflows.py",
"lp_schedules.py",
"customizing_resources.py",
"lp_notifications.py",
"fast_registration.py",
Expand Down Expand Up @@ -241,6 +241,7 @@ def __call__(self, filename):
examples_dirs = [
"../core/flyte_basics",
"../core/control_flow",
"../core/scheduled_workflows",
"../core/type_system",
"../case_studies/ml_training/pima_diabetes",
"../case_studies/ml_training/house_price_prediction",
Expand Down Expand Up @@ -270,6 +271,7 @@ def __call__(self, filename):
gallery_dirs = [
"auto/core/flyte_basics",
"auto/core/control_flow",
"auto/core/scheduled_worflows",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you reach here, i think we will have to add it to the panels page? and use the clock icon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"auto/core/type_system",
"auto/case_studies/ml_training/pima_diabetes",
"auto/case_studies/ml_training/house_price_prediction",
Expand Down