-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagster-airflow] pass airflow dag timezone to dagster schedule defin…
…ition (#11663)
- Loading branch information
1 parent
9adccb5
commit 5482236
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.../dagster-airflow/dagster_airflow_tests/test_dagster_job_factory/test_schedule_timezone.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pendulum | ||
import pytest | ||
from airflow import __version__ as airflow_version | ||
from airflow.models.dag import DAG | ||
from dagster import job | ||
from dagster_airflow.dagster_pipeline_factory import make_dagster_schedule_from_airflow_dag | ||
|
||
|
||
@pytest.mark.skipif(airflow_version < "2.0.0", reason="requires airflow 2") | ||
def test_schedule_timezone(): | ||
args = { | ||
"owner": "airflow", | ||
"start_date": pendulum.today("Europe/London").add(days=-2), | ||
} | ||
dag = DAG( | ||
dag_id="test_schedules", | ||
default_args=args, | ||
schedule="0 0 * * *", | ||
) | ||
|
||
@job | ||
def job_def(): | ||
return | ||
|
||
schedule = make_dagster_schedule_from_airflow_dag(dag=dag, job_def=job_def) | ||
assert schedule.cron_schedule == "0 0 * * *" | ||
assert schedule.execution_timezone == "Europe/London" |