You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JiraOperator fails when creating a ticket (create_issue) using jira_method_args ( airflow.providers.atlassian.jira.operators.jira import JiraOperator )
#38983
I've been testing the JiraOperator operator for a few days by passing arguments to the create_issue method. This is the dag code:
from airflow.models import DAG
from airflow.providers.atlassian.jira.operators.jira import JiraOperator
from functools import partial
from datetime import datetime
from datetime import timedelta
dag = DAG(
dag_id='test_jira',
default_args=default_args,
max_active_runs=1,
description='Test to create a Jira ticket',
schedule_interval=None,
tags=[],
catchup=False,
dagrun_timeout=timedelta(minutes=2)
)
t0 = CustomJiraOperator(
task_id='create_ticket_jira',
jira_conn_id='jira_airflow_pro', ### Id to connect Jira. Working fine
jira_method='create_issue',
jira_method_args = custom_missing_files_dict,
result_processor = print_issue_key,
params={
'frequency': 'daily',
'actions': ACTIONS
},
dag=dag
)
But it always fails me with the following:
default-hostname
*** Reading remote logs from Cloud Logging.
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1104} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [queued]>
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1104} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [queued]>
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1309} INFO - Starting attempt 1 of 1
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1328} INFO - Executing <Task(JiraOperator): crear_jira> on 2024-04-05 12:03:37.322337+00:00
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:57} INFO - Started process 295226 to run task
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:84} INFO - Running: ['airflow', 'tasks', 'run', 'test_jira', 'crear_jira', 'manual__2024-04-05T12:03:37.322337+00:00', '--job-id', '10013', '--raw', '--subdir', 'DAGS_FOLDER/tests/test_jira.py', '--cfg-path', '/tmp/tmpzd1a5lqi']
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:85} INFO - Job 10013: Subtask crear_jira
[2024-04-05, 14:03:41 CEST] {task_command.py:414} INFO - Running <TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [running]> on host airflow-worker-4hszf
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1547} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='Capgemini' AIRFLOW_CTX_DAG_ID='test_jira' AIRFLOW_CTX_TASK_ID='crear_jira' AIRFLOW_CTX_EXECUTION_DATE='2024-04-05T12:03:37.322337+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2024-04-05T12:03:37.322337+00:00'
[2024-04-05, 14:03:42 CEST] {base.py:73} INFO - Using connection ID 'jira_airflow_pro' for task execution.
[2024-04-05, 14:03:42 CEST] {taskinstance.py:1826} ERROR - Task failed with exception
**Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/atlassian/jira/operators/jira.py", line 78, in execute
jira_result: Any = getattr(resource, self.method_name)(self.jira_method_args)
TypeError: create_issue() got an unexpected keyword argument 'project'
[2024-04-05, 14:03:42 CEST] {taskinstance.py:1346} INFO - Marking task as FAILED. dag_id=test_jira, task_id=crear_jira, execution_date=20240405T120337, start_date=20240405T120341, end_date=20240405T120342
[2024-04-05, 14:03:42 CEST] {logging_mixin.py:150} INFO - Variable enable_ticket_creation is set to 1
[2024-04-05, 14:03:42 CEST] {logging_mixin.py:150} INFO - Jira ticket creation is enabled.
[2024-04-05, 14:03:42 CEST] {warnings.py:109} WARNING - /opt/python3.8/lib/python3.8/site-packages/airflow/utils/context.py:205: AirflowContextDeprecationWarning: Accessing 'execution_date' from the template is deprecated and will be removed in a future version. Please use 'data_interval_start' or 'logical_date' instead.
warnings.warn(_create_deprecation_warning(key, self._deprecation_replacements[key]))
[2024-04-05, 14:03:43 CEST] {base.py:73} INFO - Using connection ID 'jira_airflow' for task execution.
[2024-04-05, 14:03:43 CEST] {standard_task_runner.py:104} ERROR - Failed to execute job 10013 for task crear_jira ('functools.partial' object has no attribute 'module'; 295226)
[2024-04-05, 14:03:43 CEST] {local_task_job_runner.py:225} INFO - Task exited with return code 1
[2024-04-05, 14:03:43 CEST] {taskinstance.py:2656} INFO - 0 downstream tasks scheduled from follow-on schedule check
I have done many tests, but I cannot open the ticket, always with the same error.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello!.
I've been testing the JiraOperator operator for a few days by passing arguments to the create_issue method. This is the dag code:
from airflow.models import DAG
from airflow.providers.atlassian.jira.operators.jira import JiraOperator
from functools import partial
from datetime import datetime
from datetime import timedelta
custom_missing_files_dict = {
'project': {'XXXX'},
'issuetype': {'id': 'XXXX'},
'reporter': {'name': 'Airflow'}, # Reporter
'summary': "This is a test.", # Summary
'customfield_10700': [{'key': 'XXX-XXX'}], # Application
'customfield_10701': [{'key': 'XXX-XXX'}], # Urgency
'customfield_10702': [{'key': 'XXX-XXX'}], # Impact
'description': "This is a test",
'customfield_10706': [{'value': 'Production'}]
}
ACTIONS = "This is a test."
default_args = {
'owner': 'Owner',
'depends_on_past': False,
'start_date': datetime(2023, 1, 1),
'email': None,
'email_on_failure': False,
'email_on_retry': False,
'retries': 0,
'trigger_rule': 'all_success'
}
dag = DAG(
dag_id='test_jira',
default_args=default_args,
max_active_runs=1,
description='Test to create a Jira ticket',
schedule_interval=None,
tags=[],
catchup=False,
dagrun_timeout=timedelta(minutes=2)
)
t0 = CustomJiraOperator(
task_id='create_ticket_jira',
jira_conn_id='jira_airflow_pro', ### Id to connect Jira. Working fine
jira_method='create_issue',
jira_method_args = custom_missing_files_dict,
result_processor = print_issue_key,
params={
'frequency': 'daily',
'actions': ACTIONS
},
dag=dag
)
But it always fails me with the following:
default-hostname
*** Reading remote logs from Cloud Logging.
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1104} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [queued]>
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1104} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [queued]>
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1309} INFO - Starting attempt 1 of 1
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1328} INFO - Executing <Task(JiraOperator): crear_jira> on 2024-04-05 12:03:37.322337+00:00
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:57} INFO - Started process 295226 to run task
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:84} INFO - Running: ['airflow', 'tasks', 'run', 'test_jira', 'crear_jira', 'manual__2024-04-05T12:03:37.322337+00:00', '--job-id', '10013', '--raw', '--subdir', 'DAGS_FOLDER/tests/test_jira.py', '--cfg-path', '/tmp/tmpzd1a5lqi']
[2024-04-05, 14:03:41 CEST] {standard_task_runner.py:85} INFO - Job 10013: Subtask crear_jira
[2024-04-05, 14:03:41 CEST] {task_command.py:414} INFO - Running <TaskInstance: test_jira.crear_jira manual__2024-04-05T12:03:37.322337+00:00 [running]> on host airflow-worker-4hszf
[2024-04-05, 14:03:41 CEST] {taskinstance.py:1547} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='Capgemini' AIRFLOW_CTX_DAG_ID='test_jira' AIRFLOW_CTX_TASK_ID='crear_jira' AIRFLOW_CTX_EXECUTION_DATE='2024-04-05T12:03:37.322337+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2024-04-05T12:03:37.322337+00:00'
[2024-04-05, 14:03:42 CEST] {base.py:73} INFO - Using connection ID 'jira_airflow_pro' for task execution.
[2024-04-05, 14:03:42 CEST] {taskinstance.py:1826} ERROR - Task failed with exception
**Traceback (most recent call last):
File "/opt/python3.8/lib/python3.8/site-packages/airflow/providers/atlassian/jira/operators/jira.py", line 78, in execute
jira_result: Any = getattr(resource, self.method_name)(self.jira_method_args)
TypeError: create_issue() got an unexpected keyword argument 'project'
[2024-04-05, 14:03:42 CEST] {taskinstance.py:1346} INFO - Marking task as FAILED. dag_id=test_jira, task_id=crear_jira, execution_date=20240405T120337, start_date=20240405T120341, end_date=20240405T120342
[2024-04-05, 14:03:42 CEST] {logging_mixin.py:150} INFO - Variable enable_ticket_creation is set to 1
[2024-04-05, 14:03:42 CEST] {logging_mixin.py:150} INFO - Jira ticket creation is enabled.
[2024-04-05, 14:03:42 CEST] {warnings.py:109} WARNING - /opt/python3.8/lib/python3.8/site-packages/airflow/utils/context.py:205: AirflowContextDeprecationWarning: Accessing 'execution_date' from the template is deprecated and will be removed in a future version. Please use 'data_interval_start' or 'logical_date' instead.
warnings.warn(_create_deprecation_warning(key, self._deprecation_replacements[key]))
[2024-04-05, 14:03:43 CEST] {base.py:73} INFO - Using connection ID 'jira_airflow' for task execution.
[2024-04-05, 14:03:43 CEST] {standard_task_runner.py:104} ERROR - Failed to execute job 10013 for task crear_jira ('functools.partial' object has no attribute 'module'; 295226)
[2024-04-05, 14:03:43 CEST] {local_task_job_runner.py:225} INFO - Task exited with return code 1
[2024-04-05, 14:03:43 CEST] {taskinstance.py:2656} INFO - 0 downstream tasks scheduled from follow-on schedule check
I have done many tests, but I cannot open the ticket, always with the same error.
Can anybody help me?
Thank you!.
Beta Was this translation helpful? Give feedback.
All reactions