From 9b762f6d4092b438cb2b135a78208250d30f0e91 Mon Sep 17 00:00:00 2001 From: Pedram Navid <1045990+PedramNavid@users.noreply.github.com> Date: Thu, 15 Aug 2024 20:54:16 -0700 Subject: [PATCH] update per comments --- .../docs/guides/automation/asset-sensors.md | 1 + ...ynamic-pipelines-based-on-external-data.md | 4 +- .../running-pipelines-on-a-schedule.md | 4 -- .../docs/guides/automation/schedules.md | 69 ++++++++++++++++++- .../triggering-pipeline-runs-using-events.md | 2 +- .../Dagster/section-heading-sentence-case.yml | 5 ++ 6 files changed, 75 insertions(+), 10 deletions(-) delete mode 100644 docs/docs-next/docs/guides/automation/running-pipelines-on-a-schedule.md create mode 100644 docs/vale/styles/Dagster/section-heading-sentence-case.yml diff --git a/docs/docs-next/docs/guides/automation/asset-sensors.md b/docs/docs-next/docs/guides/automation/asset-sensors.md index 27d27ce1f8591..1d928c3cc59bc 100644 --- a/docs/docs-next/docs/guides/automation/asset-sensors.md +++ b/docs/docs-next/docs/guides/automation/asset-sensors.md @@ -1,5 +1,6 @@ --- title: Asset Sensors +sidebar_position: 50 --- ### Basic Asset Sensor Example diff --git a/docs/docs-next/docs/guides/automation/creating-dynamic-pipelines-based-on-external-data.md b/docs/docs-next/docs/guides/automation/creating-dynamic-pipelines-based-on-external-data.md index 6aa876233cae2..98576d9d32794 100644 --- a/docs/docs-next/docs/guides/automation/creating-dynamic-pipelines-based-on-external-data.md +++ b/docs/docs-next/docs/guides/automation/creating-dynamic-pipelines-based-on-external-data.md @@ -1,6 +1,6 @@ --- title: "Creating dynamic pipelines based on external data" -sidebar_position: 3 +sidebar_position: 30 --- -# Creating dynamic pipelines based on external data \ No newline at end of file +# Creating dynamic pipelines based on external data diff --git a/docs/docs-next/docs/guides/automation/running-pipelines-on-a-schedule.md b/docs/docs-next/docs/guides/automation/running-pipelines-on-a-schedule.md deleted file mode 100644 index acd4159ad27dc..0000000000000 --- a/docs/docs-next/docs/guides/automation/running-pipelines-on-a-schedule.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Scheduling pipelines" -sidebar_position: 1 ---- diff --git a/docs/docs-next/docs/guides/automation/schedules.md b/docs/docs-next/docs/guides/automation/schedules.md index 8e394b2964cf4..db5105529916e 100644 --- a/docs/docs-next/docs/guides/automation/schedules.md +++ b/docs/docs-next/docs/guides/automation/schedules.md @@ -1,11 +1,74 @@ --- -title: Scheduling Examples +title: "Scheduling pipelines" +sidebar_label: "Running pipelines on a schedule" +sidebar_position: 10 --- -### Basic Schedule Example +## Basic Schedule Example + +A basic schedule is defined by a `JobDefinition` and a `cron_schedule` using the `ScheduleDefinition` class. -For more examples of schedules, see the [How-To Use Schedules](/guides/automation/schedules) guide. +## How to Set Custom Timezones + +By default, schedules without a timezone will run in UTC. If you want to run a schedule in a different timezone, you can +set the `timezone` parameter. + +```python +ecommerce_schedule = ScheduleDefinition( + job=ecommerce_job, + cron_schedule="15 5 * * 1-5", +timezone="America/Los_Angeles", +) +``` + +## How to Create Partitioned Schedules + +If you have a partitioned asset and job, you can create a schedule from the partition using `build_schedule_from_partitioned_job`. +The schedule will execute as the same cadence specified by the partition definition. + +```python +from dagster import ( + asset, + build_schedule_from_partitioned_job, + define_asset_job, + DailyPartitionsDefinition, +) + +daily_partition = DailyPartitionsDefinition(start_date="2024-05-20") + + +@asset(partitions_def=daily_partition) +def daily_asset(): ... + +partitioned_asset_job = define_asset_job("partitioned_job", selection=[daily_asset]) + +# highlight-start +# This partition will run daily +asset_partitioned_schedule = build_schedule_from_partitioned_job( + partitioned_asset_job, +) +# highlight-end + +``` + +If you have a partitioned job, you can create a schedule from the partition using `build_schedule_from_partitioned_job`. + +```python +from dagster import build_schedule_from_partitioned_job, job + + +@job(config=partitioned_config) +def partitioned_op_job(): ... + +# highlight-start +partitioned_op_schedule = build_schedule_from_partitioned_job( + partitioned_op_job, +) +# highlight-end +``` + +--- For more information about how Schedules work, see the [About Schedules](/concepts/schedules) concept page. diff --git a/docs/docs-next/docs/guides/automation/triggering-pipeline-runs-using-events.md b/docs/docs-next/docs/guides/automation/triggering-pipeline-runs-using-events.md index 6886e2946584c..17826f1c536e4 100644 --- a/docs/docs-next/docs/guides/automation/triggering-pipeline-runs-using-events.md +++ b/docs/docs-next/docs/guides/automation/triggering-pipeline-runs-using-events.md @@ -1,4 +1,4 @@ --- title: "Creating event-based pipelines" -sidebar_position: 2 +sidebar_position: 20 --- diff --git a/docs/vale/styles/Dagster/section-heading-sentence-case.yml b/docs/vale/styles/Dagster/section-heading-sentence-case.yml new file mode 100644 index 0000000000000..93244ad05e7c6 --- /dev/null +++ b/docs/vale/styles/Dagster/section-heading-sentence-case.yml @@ -0,0 +1,5 @@ +extends: capitalization +message: "'%s' should be in sentence case" +level: error +scope: heading +match: $sentence