Airflow 无法在中部署DAG

Airflow 无法在中部署DAG,airflow,google-cloud-dataproc,Airflow,Google Cloud Dataproc,我无法在气流中部署DAG。不断地犯同样的错误。 在8080端口上运行,调度程序也处于打开状态 Running %s on host %s <TaskInstance: bworkflow_dag.bworkflow_template 2020-08-11T00:00:00+00:00 [failed]> airflow-instance-test.c.cc-data-sandbox.internal [2020-08-11 14:46:29,030] {__init__.py:50}

我无法在气流中部署DAG。不断地犯同样的错误。 在8080端口上运行,调度程序也处于打开状态

Running %s on host %s <TaskInstance: bworkflow_dag.bworkflow_template 2020-08-11T00:00:00+00:00 [failed]> airflow-instance-test.c.cc-data-sandbox.internal
[2020-08-11 14:46:29,030] {__init__.py:50} INFO - Using executor SequentialExecutor
[2020-08-11 14:46:29,031] {dagbag.py:396} INFO - Filling up the DagBag from /home/kshitij/airflow/dags
/home/kshitij/.local/lib/python3.5/site-packages/airflow/models/dag.py:1342: PendingDeprecationWarning: The requested task could not be added to the DAG because a task with task_id create_tag_template_field_result is already in the DAG. Starting in Airflow 2.0, trying to overwrite a task will raise an exception.
  category=PendingDeprecationWarning)
Running %s on host %s <TaskInstance: bworkflow_dag.bworkflow_template 2020-08-11T00:00:00+00:00 [failed]> airflow-instance-test.c.cc-data-sandbox.internal
这是一个单一的任务,达格


让我知道哪里出了问题。

正如在评论中所讨论的,下面的行不是必需的,需要删除

...
workflow_template


if __name__ == "__main__":
    dag.cli()
一个接一个

  • 工作流\u模板
    :这不起任何作用;仅引用包含
    任务的变量(删除它只是清理)
  • 如果uuuu name_uuuu==“uuuuu main_uuuuuu”:
    :仅当文件被删除时才执行某段代码。DAG文件中不需要
  • dag.cli()
    :我相信这就是酒杯。我以前没有使用过此方法,但声明它公开了一个特定于此DAG的CLI,这给解析DAG定义文件的进程造成了问题(
    webserver

最后3行(来自
workflow\u template
task variable blank reference,没有任何理由
id\uuuu name\uuuu==“\uuuu main\uuuu”
dag.cli()
)是不必要的,请删除它们[特别是
dag.cli()
:我不确定它的作用,但这可能会导致问题]您使用Google Cloud Composer吗?如果是这样的话,我会建议标记它们并删除CloudDataProc。@GaurangiSaxena我在GCP上托管了一个VM,并在端口上使用气流8080@y2k-shubham成功了。。评论了这个
\uuuu name\uuuu==“\uuuuu main\uuuuuuu”和dag.cli()
@y2k shubham你能把它放在答案中,这样我就可以把它标记为完整的吗?
...
workflow_template


if __name__ == "__main__":
    dag.cli()