Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
schnie committed Sep 24, 2018
0 parents commit 5b33e60
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .astro/config.yaml
@@ -0,0 +1,7 @@
cloud:
api:
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiZGZmYWEyMmQtYTI2NC00NmE2LWE5MzktZWFiZWE5OTU0NjQyIiwiaWF0IjoxNTM2ODYzOTk5LCJleHAiOjE1MzY5NTAzOTl9.TCepywmtlSpIFtmQpsHLq47ujl2ZF9cnr5bYb38YGQ4
domain: datarouter.ai
project:
name: open-example-dags
workspace: c11cec2b-954d-46fb-a649-519ce9ac23ec
2 changes: 2 additions & 0 deletions .dockerignore
@@ -0,0 +1,2 @@
.astro
.git
10 changes: 10 additions & 0 deletions .drone.yml
@@ -0,0 +1,10 @@
pipeline:
build:
image: astronomerio/ap-build:0.0.7
commands:
- docker build -t registry.datarouter.ai/uninhabited-molecular-9066/airflow:${DRONE_BUILD_NUMBER} .
volumes:
- /var/run/docker.sock:/var/run/docker.sock
when:
event: push
branch: [ master, release-* ]
1 change: 1 addition & 0 deletions Dockerfile
@@ -0,0 +1 @@
FROM astronomerinc/ap-airflow:0.5.1-rc.6-onbuild
91 changes: 91 additions & 0 deletions dags/example-dag.py
@@ -0,0 +1,91 @@
import airflow
from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta

default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': airflow.utils.dates.days_ago(2000),
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=10),
}

dag = DAG('example_dag',
schedule_interval=timedelta(minutes=1),
default_args=default_args)

t1 = BashOperator(
task_id='print_date001',
bash_command='sleep 3s',
dag=dag)

t2 = BashOperator(
task_id='print_date2',
bash_command='sleep 3s',
dag=dag)

t3 = BashOperator(
task_id='print_date3',
bash_command='sleep 3s',
dag=dag)

t4 = BashOperator(
task_id='print_date4',
bash_command='sleep 3s',
dag=dag)

t5 = BashOperator(
task_id='print_date5',
bash_command='sleep 3s',
dag=dag)

t6 = BashOperator(
task_id='print_date6',
bash_command='sleep 3s',
dag=dag)

t7 = BashOperator(
task_id='print_date7',
bash_command='sleep 3s',
dag=dag)

t8 = BashOperator(
task_id='print_date8',
bash_command='sleep 3s',
dag=dag)

t2.set_upstream(t1)
t3.set_upstream(t2)
t4.set_upstream(t3)
t5.set_upstream(t3)
t6.set_upstream(t3)
t7.set_upstream(t3)
t8.set_upstream(t3)

t9 = BashOperator(
task_id='print_date9',
bash_command='sleep 3s',
dag=dag)

t10 = BashOperator(
task_id='print_date10',
bash_command='sleep 3s',
dag=dag)

t11 = BashOperator(
task_id='print_date11',
bash_command='sleep 3s',
dag=dag)

t12 = BashOperator(
task_id='print_date12',
bash_command='sleep 3s',
dag=dag)

t9.set_upstream(t8)
t10.set_upstream(t8)
t11.set_upstream(t8)
t12.set_upstream(t8)
54 changes: 54 additions & 0 deletions dags/example_bash_operator.py
@@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
#
# Licensed 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.

import airflow
from builtins import range
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOperator
from airflow.models import DAG
from datetime import timedelta


args = {
'owner': 'airflow',
'start_date': airflow.utils.dates.days_ago(2000),
}

dag = DAG(
dag_id='example_bash_operator', default_args=args,
schedule_interval='0 0 * * *',
dagrun_timeout=timedelta(minutes=1))

run_this_last = DummyOperator(task_id='run_this_last', dag=dag)

run_this = BashOperator(
task_id='run_after_loop', bash_command='echo 1', dag=dag)
run_this.set_downstream(run_this_last)

for i in range(3):
i = str(i)
task = BashOperator(
task_id='runme_'+i,
bash_command='echo "{{ task_instance_key_str }}" && sleep 1',
dag=dag)
task.set_downstream(run_this)

task = BashOperator(
task_id='also_run_this',
bash_command='echo "run_id={{ run_id }} | dag_run={{ dag_run }}"',
dag=dag)
task.set_downstream(run_this_last)

if __name__ == "__main__":
dag.cli()
Empty file added packages.txt
Empty file.
1 change: 1 addition & 0 deletions requirements.txt
@@ -0,0 +1 @@
noop

0 comments on commit 5b33e60

Please sign in to comment.