Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Airflow 气流调试:在vscode中运行DAG时如何跳过回填作业执行_Airflow - Fatal编程技术网

Airflow 气流调试:在vscode中运行DAG时如何跳过回填作业执行

Airflow 气流调试:在vscode中运行DAG时如何跳过回填作业执行,airflow,Airflow,我已设置气流,正在使用以下vscode调试配置运行DAG: { "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", &quo

我已设置气流,正在使用以下vscode调试配置运行DAG:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false,
            "env":{
                "AIRFLOW__CORE__EXECUTOR": "DebugExecutor",
                "AIRFLOW__DEBUG__FAIL_FAST": "True",
                "LC_ALL": "en_US.UTF-8",
                "LANG": "en_US.UTF-8"
            }
        }
    ]
}
它运行文件,我的断点DAG def按预期断开,然后在文件末尾:它执行
DAG.run()
,然后我永远等待DAG回填,而我在任务的python可调用函数中的断点永远不会断开

我没有看到什么秘密

这是我的dag:

# scheduled to run every minute, poke for a new file every ten seconds
dag = DAG(
    dag_id='download-from-s3',
    start_date=days_ago(2),
    catchup=False,
    schedule_interval='*/1 * * * *',
    is_paused_upon_creation=False
)

def new_file_detection(**context):
 print("File found...") # a breakpoint here never lands
 pprint(context)

init = BashOperator(
    task_id='init',
    bash_command='echo "My DAG initiated at $(date)"',
    dag=dag,
)
 
file_sensor = S3KeySensor(
    task_id='file_sensor',
    poke_interval=10, # every 10 seconds
    timeout=60, 
    bucket_key="s3://inbox/new/*",
    bucket_name=None,
    wildcard_match=True,
    soft_fail=True,
    dag=dag
)

file_found_message = PythonOperator(
    task_id='file_found_message',
    provide_context=True,
    python_callable=new_file_detection,
    dag=dag
 )
 
init >> file_sensor >> file_found_message

if __name__ == '__main__':
    dag.clear(reset_dag_runs=True)
    dag.run() #this triggers a backfill job

这对我来说就像预期的那样。我可以在DAG级别设置断点,或者在python callables定义中设置断点,并使用VSCode调试器检查断点

我使用的调试设置与您提供的相同,但我将参数
reset\u dag\u runs=True
更改为
dag\u run\u state=state.NONE
dag.clear()。我相信在最新发布的一个版本中,这种情况已经发生了变化

关于反填充,我在DAG参数上设置了
catchup=False
(它双向工作)。重要提示,我正在运行气流的2.0.0版

下面是一个使用默认安装附带的
example\u xcomp.py
中相同代码的示例:

调试设置:

{
“版本”:“0.2.0”,
“配置”:[
{
“名称”:“Python:当前文件”,
“类型”:“python”,
“请求”:“启动”,
“程序”:“${file}”,
“控制台”:“内部控制台”,
“justMyCode”:错误,
“环境”:{
“气流核心执行器”:“调试执行器”,
“气流调试失败快速”:“正确”,
}
}
]
}
示例DAG:

导入日志
从气流导入DAG
从afflow.operators.python导入PythonOperator
从airflow.utils.dates导入天\u
dag=dag(
“例外情况”,
计划时间间隔=“一次”,
开始日期=日前(2),
默认参数={'owner':'afflow'},
标记=['example'],
catchup=False
)
值_1=[1,2,3]
值_2={'a':'b'}
def推送(**kwargs):
“”“推送没有特定目标的XCom”“”

logging.info(“推前登录”)#你的描述让我有点困惑。你是说S3KeySensor永远不会进入成功模式,因此PythonOperator永远不会被触发?@Elad-PythonOperator中的我的断点永远不会被触发。我看到的日志表明回填作业正在运行。回填作业实际上是为了S3KeySensor的成功而运行的?是的,当我启动Web服务器和调度器时它会成功