Last active
March 13, 2022 19:07
-
-
Save cdugeai/dd1e9774b72f55ab64751bb412fa7f59 to your computer and use it in GitHub Desktop.
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
"""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