MaksYermak commented on PR #60712: URL: https://github.com/apache/airflow/pull/60712#issuecomment-3779484671
Hello @KamranImaaz thank you for your PR! You mentioned in the [issue](https://github.com/apache/airflow/issues/60687) that we do not need this `try ... except` block in the Operator side because we handle it on the Hook side. I have checked the Hook code for `delete_instance` and `get_instance` methods and I do not see any `try...except` block in these methods which handles the `google.api_core.exceptions.NotFound` exception. Here is the code for [delete_instance](https://github.com/apache/airflow/blob/main/providers/google/src/airflow/providers/google/cloud/hooks/bigtable.py#L84C1-L105C1) and [get_instance](https://github.com/apache/airflow/blob/main/providers/google/src/airflow/providers/google/cloud/hooks/bigtable.py#L69C1-L85C1). As I see `get_instance` method has a `if-clause` statement which is checking `instance` for existing and returns `None` in case if `instance` does not exist and `delete_instance` relies on it and prints warning message in the logs. @KamranImaaz could you please clarify if I missed something? In my opinion it is not the same as handling errors by the `try ... except` block. This line of the code: `instance = self._get_client(project_id=project_id).instance(instance_id)` still can produce `google.api_core.exceptions.NotFound` exception and I do not see any proves that removing `try ... execept` block does not break `BigtableDeleteInstanceOperator` operator. Because this `try ... execpt` block is needed for finishing the task successfully in case when `instance` is not found. @KamranImaaz could you please share with us the screenshots that the task which runs this operator has the same behavior as before and will not fail in case when the instance is not found? -- 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]
