Error handling 如何解决疑难问题';超时';气流误差

Error handling 如何解决疑难问题';超时';气流误差,error-handling,timeout,airflow,Error Handling,Timeout,Airflow,我有一个新的DAG,它执行3个任务的操作,DAG运行正常,但我不时会收到顶部红色的“超时”错误消息。我现在知道这是为什么了 有人知道原因是什么吗 以下是我的代码(由于谨慎的原因,我更改了一些参数): 你知道这是什么原因吗 当你点击“失败状态”的任务时,应该有一个日志。你检查过日志了吗?你能粘贴你的DAG代码或至少相关部分吗?你能指出你代码中长期运行的部分吗?您的气流设置是本地的还是使用芹菜等。?为了获得帮助,请提供尽可能多的细节。没有失败的任务,它们都是绿色的。我在主屏幕上看到“超时”错误,就像

我有一个新的DAG,它执行3个任务的操作,DAG运行正常,但我不时会收到顶部红色的“超时”错误消息。我现在知道这是为什么了

有人知道原因是什么吗

以下是我的代码(由于谨慎的原因,我更改了一些参数):


你知道这是什么原因吗

当你点击“失败状态”的任务时,应该有一个日志。你检查过日志了吗?你能粘贴你的DAG代码或至少相关部分吗?你能指出你代码中长期运行的部分吗?您的气流设置是本地的还是使用芹菜等。?为了获得帮助,请提供尽可能多的细节。没有失败的任务,它们都是绿色的。我在主屏幕上看到“超时”错误,就像在“DAG损坏”的情况下收到错误消息一样。我正在使用芹菜,我相信日志与本例无关,因为我没有失败的任务。当您单击“失败状态”的任务时,应该有一个日志。您检查了日志了吗?你能粘贴你的DAG代码或至少相关部分吗?你能指出你代码中长期运行的部分吗?您的气流设置是本地的还是使用芹菜等。?为了获得帮助,请提供尽可能多的细节。没有失败的任务,它们都是绿色的。我在主屏幕上看到“超时”错误,就像在“DAG损坏”的情况下收到错误消息一样。我用的是芹菜,我相信日志与本例无关,因为我没有失败的任务。
from airflow import DAG
from airflow.operators.mysql_operator import MySqlOperator
from datetime import datetime
from airflow.operators.sensors import NamedHivePartitionSensor
from airflow.hooks.presto_hook import PrestoHook
import sys
import os
import logging
sys.path.append(os.environ['SSSSSS'] + '/WWW/WWWWW')
from utils import sql_to_string, parse_exec_to_time, parse_exec_to_date, NewPrestoOperator
from config import emails
from NotifyOperator import NotifyOperator

########################################################################
# Parameters to be set


default_args = {
    'owner': 'etl',
    'start_date': datetime(2019, 04, 15, 0, 0),
    'depends_on_past': True,
    'wait_for_downstream': True,
    'email': data_team_emails,
    'email_on_failure': True,
    'email_on_retry': False
}

dag = DAG(dag_id='g13-new_lead_form_alert',
          default_args=default_args,
          max_active_runs=1,
          schedule_interval='0 * * * *')


def _get_records_pandas(query):
    start_time = datetime.now()
    logging.log(logging.INFO, "Extract Query={}".format(query))
    records = PrestoHook(presto_conn_id='{0}-new'.format(os.environ['YYYYY'])).get_pandas_df(query)
    logging.log(logging.INFO, "Extract completed. it took:{}".format(str(datetime.now() - start_time)))
    return records


SELECT_ALL_QUERY = 'select title, pageloadid from mysql.{0}.agg_pageloadid_lead_form'.format(os.environ['DDDDDD'])

t0 = NamedHivePartitionSensor(task_id='g13-00-wait_for_partition',
                              partition_names=['{2}.table/dt={0}/tm={1}/'.format(
                                  '{{ (execution_date + macros.timedelta(minutes=60)).strftime(\'%Y-%m-%d\')}}',
                                  '{{ (execution_date + macros.timedelta(minutes=60)).strftime(\'%H\')}}',
                                  os.environ['XXXXX'])],
                              metastore_conn_id='RRRRRR',
                              dag=dag,
                              soft_fail=True,
                              pool='sensor_tasks',
                              retries=5
                              )

t1 = MySqlOperator(
    task_id='g13-01-truncate',
    sql='''
    truncate table {0}.agg_pageloaduid_lead_form
    '''.format(os.environ['LLLLL']),
    mysql_conn_id='AAAA',
    dag=dag)


t2 = NewPrestoOperator(
    task_id="g13-02-insert_new_lead",
    sql=sql_to_string("/g13_insert_new_lead.sql").format(
        os.environ['YYYYY'],
        '{{execution_date.strftime(\'%Y-%m-%d\')}}',
        '{{execution_date.strftime(\'%H\')}}',
        os.environ['ETL_ENVIRONMENT']),
    presto_conn_id='{0}-new'.format(os.environ['XXXXX']),
    provide_context=True,
    fail_on_zero_rows=False,
    retries=5,
    retry_delay=60,
    pool='presto_tasks',
    dag=dag
)


t3 = NotifyOperator(
    task_id='g13-03-notification',
    channels=['test'],
    email_recipients=[],
    email_subject='New Lead Alert',
    email_template="""abc""",
    op_kwargs={
        'title': 'New Lead Form',
        'response': _get_records_pandas(SELECT_ALL_QUERY)
    },
    dag=dag
)

t0 >> t1 >> t2 >> t3