Skip to content

Conversation

@fweilun
Copy link
Contributor

@fweilun fweilun commented Aug 7, 2025

Resolve: #53647 (comment)

Originally, self.blob_service_client was set to None and later assigned via the get_async_conn() function, which does not follow the @cached_property pattern.
Therefore, we added a setter to allow direct injection into WasbAsyncHook.

Copy link
Contributor

@prdai prdai left a comment

Choose a reason for hiding this comment

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

other than the unrelated file, everything else LGTM!

@fweilun fweilun force-pushed the rework-microsoft-azure-blob-service-client branch from 72d6e4c to 8f9b60d Compare August 11, 2025 09:33
Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

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

will need some unit tests

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for the PR, but the unit test still needs fix:

Error logs:
https://github.com/apache/airflow/actions/runs/16898665165/job/47873847733?pr=54219

@fweilun
Copy link
Contributor Author

fweilun commented Aug 12, 2025

Nice! Thanks for the PR, but the unit test still needs fix:

Error logs: https://github.com/apache/airflow/actions/runs/16898665165/job/47873847733?pr=54219

Resolved. Thanks for your review. Should I also work on silencing mypy warnings?

@fweilun fweilun closed this Aug 12, 2025
@fweilun fweilun reopened this Aug 12, 2025
@fweilun fweilun force-pushed the rework-microsoft-azure-blob-service-client branch from 959f51b to fc5cb2e Compare August 12, 2025 07:37
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Should I also work on silencing mypy warnings?

It would be great to resolve the mypy errors if possible, if not then maybe we have to silence mypy warnings.

It seems that some of the mypy errors raise in CI should be resolved by adding AsyncContainerClient in the type annotation.

For example:
https://github.com/apache/airflow/pull/54219/files#diff-9774207ad78091f5ced7f3fa5e1e8f2b3d19abb50de753120b70efe25efd0036R230-R238

adding AsyncContainerClient in the type annotation should resolve the mypy error at line 238.

@jason810496
Copy link
Member

Or maybe we can split the attributes by decoupling the cache attributes for normal client and async client:

  • self._blob_service_client: BlobServiceClient
  • self._async_blob_service_client: AsyncBlobServiceClient

IMO, this might be more simpler to avoid mypy warning.

@fweilun fweilun force-pushed the rework-microsoft-azure-blob-service-client branch from fc5cb2e to a898c3c Compare August 13, 2025 14:35
@fweilun
Copy link
Contributor Author

fweilun commented Aug 14, 2025

HI @jason810496 , I’ve resolved the errors. The TODO message suggests using self.blob_service_client for both WasbAsyncHook and WasbHook, so I followed the same approach. Thanks a lot for your review and guidance.

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

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

the improvement I suggest is more like a nitpick, non-blocker

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Thanks for the update!

I just checked locally, adding BlobServiceClient to the TypeVar and explicitly casting the container variable to the corresponding type resolves the Mypy error.

@fweilun fweilun force-pushed the rework-microsoft-azure-blob-service-client branch from 280ae99 to b63957a Compare August 19, 2025 02:03
@fweilun
Copy link
Contributor Author

fweilun commented Aug 19, 2025

HI @jason810496 , I applied all the changes. Thanks for your help!

@jason810496 jason810496 merged commit 6e92943 into apache:main Aug 19, 2025
75 checks passed
mangal-vairalkar pushed a commit to mangal-vairalkar/airflow that referenced this pull request Aug 30, 2025
…tion (apache#54219)

* Convert cached_property to manual caching and add blob_service_client setter for WasbAsyncHook

* Add testcase and error handle

* Adding type implication

* Add _blob_service_client init for WasbAsyncHook

* Silence mypy warnings

* Silence mypy

* Add container type for pytest

* Add type check function

* Silence mypy

* Generalize check_for_variable_type function
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.

5 participants