【发布时间】:2021-01-22 14:25:17
【问题描述】:
def f_get_value_via_xcom(**context):
var = context['ti'].xcom_pull(dag_id='bash_execute', key='return_value')
bash_execute = BashOperator(
task_id='bash_execute',
bash_command='some bash command'
xcom_push=True,
priority_weight=100,
start_date = datetime(2021, 1, 21))
def setUp(self):
configuration.load_test_config()
args = {
'owner': 'airflow',
'start_date': DEFAULT_DATE
}
dag = DAG(dag_id='test_jira_operator',
default_args=default_args,
schedule_interval='15 9 * * *',
dagrun_timeout=timedelta(seconds=120))
db.merge_conn(
Connection(
conn_id='jira username', conn_type='jira',
host='jira server', port=443,
extra='{"verify": "False", "project": "AIRFLOW"}'))
jira_ticket_search_operator = JiraOperator(task_id='test_jira_operator',
jira_conn_id='airflow_jira',
jira_method="create_issue",
python_callable=f_get_value_via_xcom,
provide_context=True,
jira_method_args={
'project': {'id': 10000},
'summary': 'New test issue',
'description': "{{ ti.xcom_pull('php_thelia') }}",
'issuetype': {'name': 'Bug'},
},
dag=dag)
bash_execute >> jira_ticket_search_operator
我正在尝试创建一个 DAG,它创建一个新的 Jira 任务,其描述是 bash 命令的控制台输出,但我收到以下错误
*[2021-01-22 12:57:28,109] {taskinstance.py:1152} ERROR - Object of type 'Issue' is not JSON serializable*
我不明白为什么。我已经在我当前的气流脚本上方发布了。你能帮帮我吗。
【问题讨论】: