这是我的DAG:
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'xx',
'depends_on_past': False,
'start_date': datetime(2019, 5, 6)
}
dag = DAG('mysampleclone', default_args=default_args, schedule_interval=None)
task1 = BashOperator(
task_id='print_date_clone',
bash_command='date',
dag=dag)
task2 = BashOperator(
task_id='print_message_clone',
bash_command='echo hello',
dag=dag)
task1 >> task2
任务进入失败状态并显示以下日志:
*** Reading local file: /x/x/airflow/logs/mysampleclone/print_date_clone/2019-05-14T03:32:37.545742+00:00/1.log
[2019-05-14 11:32:42,577] {models.py:1361} INFO - Dependencies all met for <TaskInstance: mysampleclone.print_date_clone 2019-05-14T03:32:37.545742+00:00 [queued]>
[2019-05-14 11:32:42,580] {models.py:1361} INFO - Dependencies all met for <TaskInstance: mysampleclone.print_date_clone 2019-05-14T03:32:37.545742+00:00 [queued]>
[2019-05-14 11:32:42,580] {models.py:1573} INFO -
--------------------------------------------------------------------------------
Starting attempt 1 of 1
--------------------------------------------------------------------------------
[2019-05-14 11:32:42,606] {models.py:1595} INFO - Executing <Task(BashOperator): print_date_clone> on 2019-05-14T03:32:37.545742+00:00
[2019-05-14 11:32:42,606] {base_task_runner.py:118} INFO - Running: ['bash', '-c', 'airflow run mysampleclone print_date_clone 2019-05-14T03:32:37.545742+00:00 --job_id 34 --raw -sd DAGS_FOLDER/sample_dag2.py --cfg_path /tmp/tmp63qhg6v9']
当我从命令行运行任务时,它没有任何输出
$ airflow run mysampleclone print_date_clone 2019-05-14
[2019-05-14 15:49:13,861] {__init__.py:51} INFO - Using executor SequentialExecutor
[2019-05-14 15:49:14,055] {models.py:271} INFO - Filling up the DagBag from /x/x/airflow/dags
[2019-05-14 15:49:14,086] {cli.py:484} INFO - Running <TaskInstance: mysampleclone.print_date_clone 2019-05-14T00:00:00+00:00 [success]> on host <myhost>
[2019-05-14 15:49:14,858] {__init__.py:51} INFO - Using executor SequentialExecutor
[2019-05-14 15:49:15,042] {models.py:271} INFO - Filling up the DagBag from /x/x/airflow/dags/sample_dag2.py
[2019-05-14 15:49:15,066] {cli.py:484} INFO - Running <TaskInstance: mysampleclone.print_date_clone 2019-05-14T00:00:00+00:00 [success]> on host <myhost>
sequenceExecutor不打印输出。可能是什么问题?