Adityamalik123 commented on code in PR #27633:
URL: https://github.com/apache/airflow/pull/27633#discussion_r1039375129
##########
airflow/providers/atlassian/jira/operators/jira.py:
##########
@@ -76,16 +78,14 @@ def execute(self, context: Context) -> Any:
hook = JiraHook(jira_conn_id=self.jira_conn_id)
resource = hook.client
- # Current Jira-Python SDK (1.0.7) has issue with pickling the jira
response.
- # ex: self.xcom_push(context, key='operator_response',
value=jira_response)
- # This could potentially throw error if jira_result is not
picklable
jira_result = getattr(resource,
self.method_name)(**self.jira_method_args)
+
+ output = jira_result.get("id", None) if jira_result is not None
else None
+ self.xcom_push(context, key="id", value=output)
+
if self.result_processor:
return self.result_processor(context, jira_result)
return jira_result
-
- except JIRAError as jira_error:
- raise AirflowException(f"Failed to execute jiraOperator, error:
{str(jira_error)}")
- except Exception as e:
- raise AirflowException(f"Jira operator error: {str(e)}")
+ except HTTPError as e:
+ raise AirflowException(f"Failed to execute jiraOperator, error:
{str(e.response)}")
Review Comment:
> I think we don't really need this? the error from the sdk will simply
populate to Airflow and will fail the task.. there is not need to wrap it with
Airflow exception
I just thought since we (provider code) are calling the external library, we
should log the returned response in case of failure. Without this Its only
gonna log the traceback by default.
But yeah its not needed necessarily and i can remove it if you'd like.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]