Skip to content

Suppress any Exception in wasb task handler#27495

Merged
dstandish merged 5 commits intoapache:mainfrom
astronomer:broader-except-for-azure-task-handler
Nov 5, 2022
Merged

Suppress any Exception in wasb task handler#27495
dstandish merged 5 commits intoapache:mainfrom
astronomer:broader-except-for-azure-task-handler

Conversation

@dstandish
Copy link
Contributor

It's important that problems with the log handler don't cause the task itself to fail. We discovered that sometimes the blob client will throw an error from azure.core.AzureError (currently we catch from azure.common). Rather than just add azure.core.AzureError, it seems sensible to just catch anything.

It's important that problems with the log handler don't cause the task itself to fail. We discovered that sometimes the blob client will throw an error from azure.core.AzureError (currently we catch from azure.common). Rather than just add azure.core.AzureError, it seems sensible to just catch anything.

return WasbHook(remote_conn_id)
except AzureHttpError:
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are trying to catch everything here, the log msg below should be updated too as it was tailored for AzureHttpError. For example, we can included the exception detail itself into the log msg.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what's AzureHttpError specific about the error message? Maybe propose what you'd like to see instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jedcunningham , for example, the msg says "Please make sure that apache-airflow[azure] is installed". This would hint users that the error is due to missing apache-airflow[azure] while it's not necessarily the root cause.

I would suggest to make the error msg just general, plus adding the representation of the Exception itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so... maybe everybody can be happy with this

I have phrased it less conclusively. Making it more clear that these are just suggestions to look into. It was never the case that, were we to find ourselves in this except block, that provider wasn't installed (how is this code running in that case? maybe installed from sources???) or connection not there (that wouldn't even make it to this block before because it is AirflowNotFoundException). Now it actually could be missing connection (since we have the broader except). So the suggestion is actually better as a result of this change. Meanwhile, the provider not installed theory is ... at least... no less bad..... In any case they are just questions and not statements of fact, so I feel ok with this now.

Thanks for your help in reviewing, and let me know if any further concerns.


return WasbHook(remote_conn_id)
except AzureHttpError:
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what's AzureHttpError specific about the error message? Maybe propose what you'd like to see instead.

dstandish and others added 4 commits November 4, 2022 11:06
Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com>
@dstandish dstandish merged commit 59da943 into apache:main Nov 5, 2022
@dstandish dstandish deleted the broader-except-for-azure-task-handler branch November 5, 2022 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants