Javascript required
Skip to content Skip to sidebar Skip to footer

Airflow 1.9 Not Able to Read Logs

Getting started with Apache Airflow

Adnan Siddiqi

Credit Airflow Official Site

What is Airflow?

What is Dag?

Airflow DAG(Credit: Apache Airflow)

Installation and Setup

          [2018-09-22 15:59:23,880] {__init__.py:51} INFO - Using executor SequentialExecutor          ____________       _____________          ____    |__( )_________  __/__  /________      __          ____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /          ___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /          _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/          v1.10.0        
          2018-09-twenty 22:36:24,943] {__init__.py:51} INFO - Using executor SequentialExecutor          /anaconda3/anaconda/lib/python3.6/site-packages/airflow/bin/cli.py:1595: DeprecationWarning: The celeryd_concurrency pick in [celery] has been renamed to worker_concurrency - the onetime setting has been used, but please update your config.          default=conf.become('celery', 'worker_concurrency')),          ____________       _____________          ____    |__( )_________  __/__  /________      __          ____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /          ___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /          _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/          v1.10.0          [2018-09-nineteen xiv:21:42,340] {__init__.py:57} INFO - Using executor SequentialExecutor          ____________       _____________          ____    |__( )_________  __/__  /________      __          ____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /          ___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /          _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/          /anaconda3/anaconda/lib/python3.six/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache instead.          .format(ten=modname), ExtDeprecationWarning          [2018-09-xix 14:21:43,119] [48995] {models.py:167} INFO - Filling up the DagBag from /Development/airflow_home/dags          Running the Gunicorn Server with:          Workers: 4 sync          Host: 0.0.0.0:8080        

Airflow Spider web UI in activity

DAG (Graph View)

Basic Example

                      import            datetime            as            dt

from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator

def greet():
print('Writing in file')
with open('path/to/file/greet.txt', 'a+', encoding='utf8') as f:
now = dt.datetime.now()
t = now.strftime("%Y-%m-%d %H:%G")
f.write(str(t) + '\n')
render 'Greeted'

def reply():
return 'Greet Responded Again'
          default_args = {
'owner': 'airflow',
'start_date': dt.datetime(2018, 9, 24, ten, 00, 00),
'concurrency': one,
'retries': 0
}

Current time on Airflow Web UI
                      with            DAG('my_simple_dag',
default_args=default_args,
schedule_interval='*/ten * * * *',
) equally dag:
opr_hello = BashOperator(task_id='say_Hi',
bash_command='echo "Hi!!"')

opr_greet = PythonOperator(task_id='greet',
python_callable=greet)
opr_sleep = BashOperator(task_id='sleep_me',
bash_command='sleep five')

opr_respond = PythonOperator(task_id='respond',
python_callable=respond)

opr_hello >> opr_greet >> opr_sleep >> opr_respond

What is Airflow Scheduler?

What is DagRun?

Running DAGS since the outset date

Starting the DAG

DAG with status "Running"

DAGs backfilled

DAG with Backfills and the current one

DAG Tree View
                      with            DAG('my_simple_dag',
catchup=Imitation,
default_args=default_args,
schedule_interval='*/10 * * * *',
# schedule_interval=None,
) as dag:
          opr_hello >> opr_greet >> opr_sleep >> opr_respond        

DAG In GraphView
          opr_hello >> opr_greet >> opr_sleep << opr_respond        

Conclusion

If you like this mail then you should subscribe to my newsletter.

Airflow 1.9 Not Able to Read Logs

Source: https://towardsdatascience.com/getting-started-with-apache-airflow-df1aa77d7b1b