2016-08-08 19:23:49 +03:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
2018-04-14 10:13:23 +03:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
2018-08-21 01:44:36 +03:00
|
|
|
#
|
2018-04-14 10:13:23 +03:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2018-08-21 01:44:36 +03:00
|
|
|
#
|
2018-04-14 10:13:23 +03:00
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2016-08-08 19:23:49 +03:00
|
|
|
|
2017-04-03 23:10:51 +03:00
|
|
|
from airflow import utils
|
2016-08-08 19:23:49 +03:00
|
|
|
from airflow import DAG
|
|
|
|
from airflow.operators.dummy_operator import DummyOperator
|
2016-10-27 05:47:35 +03:00
|
|
|
from datetime import datetime, timedelta
|
2016-08-08 19:23:49 +03:00
|
|
|
|
|
|
|
now = datetime.now()
|
2018-08-21 01:44:36 +03:00
|
|
|
now_to_the_hour = (
|
|
|
|
now - timedelta(0, 0, 0, 0, 0, 3)
|
|
|
|
).replace(minute=0, second=0, microsecond=0)
|
2017-07-21 04:08:15 +03:00
|
|
|
START_DATE = now_to_the_hour
|
2016-08-08 19:23:49 +03:00
|
|
|
DAG_NAME = 'test_dag_v1'
|
|
|
|
|
|
|
|
default_args = {
|
|
|
|
'owner': 'airflow',
|
|
|
|
'depends_on_past': True,
|
2017-04-03 23:10:51 +03:00
|
|
|
'start_date': utils.dates.days_ago(2)
|
2016-08-08 19:23:49 +03:00
|
|
|
}
|
|
|
|
dag = DAG(DAG_NAME, schedule_interval='*/10 * * * *', default_args=default_args)
|
|
|
|
|
|
|
|
run_this_1 = DummyOperator(task_id='run_this_1', dag=dag)
|
|
|
|
run_this_2 = DummyOperator(task_id='run_this_2', dag=dag)
|
|
|
|
run_this_2.set_upstream(run_this_1)
|
|
|
|
run_this_3 = DummyOperator(task_id='run_this_3', dag=dag)
|
|
|
|
run_this_3.set_upstream(run_this_2)
|