Skip to content

Instantly share code, notes, and snippets.

@cdugeai
Last active March 13, 2022 19:07
Show Gist options
  • Save cdugeai/dd1e9774b72f55ab64751bb412fa7f59 to your computer and use it in GitHub Desktop.
Save cdugeai/dd1e9774b72f55ab64751bb412fa7f59 to your computer and use it in GitHub Desktop.
"""Example DAG demonstrating the usage of the BashOperator."""
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.dummy import DummyOperator
from airflow.providers.docker.operators.docker import DockerOperator
with DAG(
dag_id='bot-cartedescolocs',
schedule_interval='0 * * * *',
start_date=datetime(2021, 1, 1),
catchup=False,
dagrun_timeout=timedelta(minutes=60),
tags=['example', 'example2', 'perso'],
params={"example_key": "example_value"},
) as dag:
#connection_id ='docker://colindckr:0160109001@https%3A%2F%2Findex.docker.io%2Fv1:80?email=myemail%40my.com&reauth=False'
#connection_id ='docker://colindckr:0160109001@https%3A%2F%2Findex.docker.io%2Fv1%2F%3Femail%3Dcolin.dugeai%40gmail.com&reauth=False'
#connection_id ='docker://colindckr:0160109001'
run_first = DummyOperator(
task_id='run_first',
)
# [START howto_operator_bash]
date_echo = BashOperator(
task_id='echo_date',
bash_command='date',
)
# [END howto_operator_bash]
run_app = DockerOperator(
task_id='run_app',
image='python:3.8-slim-buster',
container_name='bot-cdc',
xcom_all=True,
docker_url='/var/run/docker.sock'
)
run_first >> date_echo
date_echo >> run_app
if __name__ == "__main__":
dag.cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment