气流任务未运行-+不支持的操作数类型:“ NoneType”和“ int”

时间:2019-12-11 04:18:39

标签: python google-cloud-platform airflow

我正在尝试运行气流以将云功能部署为示例。但是,当我在气流Web服务器中运行它时,出现以下错误。

[2019-12-11 03:52:07,181] {logging_mixin.py:95} INFO - [[34m2019-12-11 03:52:07,180[0m] 
{[34mdiscovery.py:[0m867} INFO[0m - URL being requested: GET 
https://cloudfunctions.googleapis.com/v1/projects/projectid/locations/us- 
central1/functions/airflow?alt=json[0m
[2019-12-11 03:52:07,181] {taskinstance.py:1047} ERROR - unsupported operand type(s) for +: 
'NoneType' and 'int'

我的代码如下:

from airflow import DAG
from datetime import datetime, timedelta
from airflow.contrib.operators import gcp_compute_operator
from airflow.contrib.sensors import gcs_sensor 
from airflow.contrib.operators import gcp_function_operator
from google.cloud import storage
import os
import airflow
import logging

SCHEDULE_INTERVAL = '@daily'
args = {
    "owner": "airflow",
    "start_date": datetime(2019, 12, 10),
    "retries": 3
}

GCP_CONN_ID = "bq_conn_id"
dag = DAG("staging_deployment", default_args=args, 
schedule_interval=SCHEDULE_INTERVAL)

t4 = gcp_function_operator.GcfFunctionDeployOperator(
task_id="gcf_deploy2_task",
project_id="projectid",
location="us-central1",
body={
    "name":"projects/projectid/locations/us-central1/functions/airflow",
    "entryPoint":"airflow",
    "runtime":"python37",
    "sourceArchiveUrl":"gcs bucket details",
    "httpsTrigger":{}
},
validate_body=True,
dag=dag,
gcp_conn_id=GCP_CONN_ID
)
t4

请咨询

2 个答案:

答案 0 :(得分:0)

根据错误消息[2019-12-11 03:52:07,181] {taskinstance.py:1047} ERROR - unsupported operand type(s) for +: 'NoneType' and 'int',您必须找到文件taskinstance.py,然后搜索第1047行并查看哪个操作数成为None

您的代码太短,无法找到1047行,您必须粘贴较长的代码或自己完成。

答案 1 :(得分:0)

非常感谢@Sergiy的提示升级到气流版本确实有帮助。可能与此github.com/CTFd/CTFd/issues/567有关。我之前使用的是Airflow 1.10.4,然后升级到1.10.6。