Created
April 27, 2023 19:22
-
-
Save antweiss/60f08f6b16c27cf56bf198934afe5643 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
from airflow.operators.python_operator import ShortCircuitOperator | |
from airflow.operators.dummy_operator import DummyOperator | |
from airflow.models import DAG | |
import airflow.utils.helpers | |
from airflow.operators.bash_operator import BashOperator | |
import random | |
args = { | |
'owner': 'antweiss', | |
'start_date': airflow.utils.dates.days_ago(0) | |
} | |
dag = DAG(dag_id='weather_operator', default_args=args) | |
def randbool(): | |
return bool(random.getrandbits(1)) | |
continuer = ShortCircuitOperator( | |
task_id='cont', python_callable=randbool, dag=dag) | |
show_weather = BashOperator( | |
task_id='show_weather', | |
bash_command='curl wttr.in/israel', | |
dag=dag | |
) | |
continuer.set_downstream(show_weather) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment