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/09/22 13:24:10 UTC

[GitHub] [airflow] rjmcginness opened a new pull request, #26596: Fix xcom arg.py .zip bug (#26499)

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

   Modified xcom_arg.py to test against ArgNotSet type, rather than an instance (NOTSET).
   Fixes the filling of the _ZipResult with an erroneous fill value, when .zip is called with the
   default fillvalue=NOTSET.
   
   
   closes: #26499
   related: #26499


-- 
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] rjmcginness closed pull request #26596: Fix xcom arg.py .zip bug (#26499)

Posted by GitBox <gi...@apache.org>.
rjmcginness closed pull request #26596: Fix xcom arg.py .zip bug (#26499)
URL: https://github.com/apache/airflow/pull/26596


-- 
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] rjmcginness commented on a diff in pull request #26596: Fix xcom arg.py .zip bug (#26499)

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


##########
airflow/models/xcom_arg.py:
##########
@@ -388,6 +388,9 @@ class _ZipResult(Sequence):
     def __init__(self, values: Sequence[Sequence | dict], *, fillvalue: Any = NOTSET) -> None:
         self.values = values
         self.fillvalue = fillvalue
+        # use the generator here, rather than in __len__ to improve efficiency
+        lengths = (len(v) for v in self.values)
+        self.length = min(lengths) if isinstance(self.fillvalue, ArgNotSet) else max(lengths)

Review Comment:
   Just saw this.  Sure.  I can reverse it.  



-- 
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] rjmcginness commented on pull request #26596: Fix xcom arg.py .zip bug (#26499)

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

   Excellent. That sounds great. Unless you don't want, I can start working separately on that implementation for 2.5. 


-- 
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] boring-cyborg[bot] commented on pull request #26596: Fix xcom arg.py .zip bug (#26499)

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #26596:
URL: https://github.com/apache/airflow/pull/26596#issuecomment-1255020563

   Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
   - In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
   - Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
   - Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
   - Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
   - Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
   Apache Airflow is a community-driven project and together we are making it better 🚀.
   In case of doubts contact the developers at:
   Mailing List: dev@airflow.apache.org
   Slack: https://s.apache.org/airflow-slack
   


-- 
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] rjmcginness commented on pull request #26596: Fix xcom arg.py .zip bug (#26499)

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

   @uranusjr Alternatively, __eq__ could be overridden for ArgNotSet, where equality is essentially a test of the argument type against the type of ArgNotSet. That would allow comparison by ==, though it would still not allow use of is. In my opinion, that would be better encapsulation than checking against type in downstream code. However, I am not sure of the inadvertent consequences in other code. 


-- 
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] uranusjr commented on a diff in pull request #26596: Fix xcom arg.py .zip bug (#26499)

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


##########
airflow/models/xcom_arg.py:
##########
@@ -388,6 +388,9 @@ class _ZipResult(Sequence):
     def __init__(self, values: Sequence[Sequence | dict], *, fillvalue: Any = NOTSET) -> None:
         self.values = values
         self.fillvalue = fillvalue
+        # use the generator here, rather than in __len__ to improve efficiency
+        lengths = (len(v) for v in self.values)
+        self.length = min(lengths) if isinstance(self.fillvalue, ArgNotSet) else max(lengths)

Review Comment:
   I don’t think it is very meaningful to do this. IIRC I wrote the `__len__` implementation as it previously is because the length is checked very infrequently and usually zero to one times in each process (usually in a task worker), so caching like this actually makes it consume more resource than putting the logic in `__len__`. Would you mind reverting this part? It is not really related to the overall fix and shouldn’t block it.



-- 
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] uranusjr commented on pull request #26596: Fix xcom arg.py .zip bug (#26499)

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

   I have a mind to create a more generic `is_arg_set` function for this purpose (it’s more convenient for a lot of cases). That can be done separately (maybe for 2.5 instead of a patch in 2.4) so let’s just use `isinstance` in this PR without too much magic.


-- 
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