You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/08 19:32:44 UTC

[GitHub] [airflow] malthe opened a new pull request, #28234: Make arguments 'offset' and 'length' not required

malthe opened a new pull request, #28234:
URL: https://github.com/apache/airflow/pull/28234

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   In https://github.com/apache/airflow/pull/25426, the `offset` and `length` arguments were made required. But this is not in line with the Azure blob client interface.
   
   The `length` argument is a hint to optimize performance for larger reads, while `offset` is used only for more advanced reading. We're currently using neither for log reading.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk merged pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #28234:
URL: https://github.com/apache/airflow/pull/28234


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043837071


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   Try to remove and see if it works with `--all-files` :)
   
   If it's not clear, just testing hypothesis is a good idea.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #28234:
URL: https://github.com/apache/airflow/pull/28234#issuecomment-1344312146

   Yeah. Random failure of flakey test (Which we should fix but that's another story).


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043839051


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   Unfortunately, none of us can be made responsible for clarity of docs that we have little control over, but we have control on verifying our assumptions in case they are unclear.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043839483


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   (and yes we can complain after we do).



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043784072


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   This is what we had before https://github.com/apache/airflow/pull/25426
   we needed to make the change to update to newer sdk version
   see https://github.com/apache/airflow/pull/25426#issuecomment-1233152203



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043792417


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   ah! I didn't know about this setting



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043831892


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   The docs say:
   
   > Some of the config options may be set either globally (in the [mypy] section) or on a per-module basis (in sections like [mypy-foo.bar]).



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043832758


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   But ultimately what I usually do is to add what I think works and check (run mypy static checks in this case :) ) 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043801723


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   Still @malthe you will need to add azure-storage to setup.cfg
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] malthe commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
malthe commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043854197


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   Fixed in d77e6815b9c586b6d8aa4cc72120727854a77d6e. I ended up trading one line for another, perhaps not the cleanest commit ever.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043831399


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   I think it's best to consult the docs to be sure: https://mypy.readthedocs.io/en/stable/config_file.html#examples . 
   
   I can't remember all nuances, but I beleve this is the package whic azure storage provides.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] malthe commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
malthe commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043810079


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   What's the deal with those exclusions:
   ```
   [mypy-azure.batch.*]
   no_implicit_optional = False
   [mypy-azure.batch.models.*]
   no_implicit_optional = False
   ```
   Does it pattern-match on the module where the problem is? I am not totally sure what to put here for azure-storage, @potiuk.
   ```cfg
   [mypy-azure.storage.*]
   no_implicit_optional = False
   ```
   ^^^ something like that?



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043833245


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   > This may be the solution for other azure packages #27199
   
   Likely yes.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] malthe commented on pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
malthe commented on PR #28234:
URL: https://github.com/apache/airflow/pull/28234#issuecomment-1343930188

   @potiuk seems ready to merge now.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043789573


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   I am afraid #25426 was a mistake. 
   
   They simply added type-hints but left None as default. They simply use "implict optional" and we don't use it.
   
   Implicit optional is a setting in https://github.com/apache/airflow/blob/1eaedc8ae85dbbfaaa402f9936304be51de98f88/setup.cfg#L191 to add azure-storage to list of other azure libraries.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043789573


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   I am afraid #25426 was a mistake. 
   
   They simply added type-hints but left None as default. They simply use "implict optional" and we don't use it.
   
   Implicit optional is a setting we have to add in https://github.com/apache/airflow/blob/1eaedc8ae85dbbfaaa402f9936304be51de98f88/setup.cfg#L191 to add azure-storage to list of other azure libraries.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] eladkal commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
eladkal commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043804562


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   This may be the solution for other azure packages https://github.com/apache/airflow/pull/27199



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] malthe commented on a diff in pull request #28234: Make arguments 'offset' and 'length' not required

Posted by GitBox <gi...@apache.org>.
malthe commented on code in PR #28234:
URL: https://github.com/apache/airflow/pull/28234#discussion_r1043836075


##########
airflow/providers/microsoft/azure/hooks/wasb.py:
##########
@@ -385,7 +385,7 @@ def upload(
         return blob_client.upload_blob(data, blob_type, length=length, **kwargs)
 
     def download(
-        self, container_name, blob_name, offset: int, length: int, **kwargs
+        self, container_name, blob_name, offset: int | None = None, length: int | None = None, **kwargs

Review Comment:
   From the docs it seems like a mistake to have the same rule for both "azure.batch" and "azure.batch.models". I am not totally sure what ".*" adds to the picture. The docs aren't really clear (to me at least).



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org