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/07 21:44:25 UTC

[GitHub] [airflow] notatallshaw-work opened a new pull request, #26222: For worker log servers only bind to IPV6 when dual stack is available

notatallshaw-work opened a new pull request, #26222:
URL: https://github.com/apache/airflow/pull/26222

   Fixes issue discussed at https://github.com/apache/airflow/pull/24846#issuecomment-1231578766
   
   Created as draft as I have not been able to fully set up Airflow Dev environment yet and do things such as run linting tools.


-- 
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] ashb commented on a diff in pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

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


##########
airflow/utils/serve_logs.py:
##########
@@ -143,13 +144,14 @@ def serve_logs():
 
     worker_log_server_port = conf.getint('logging', 'WORKER_LOG_SERVER_PORT')
 
-    # Make sure to have both an IPv4 and an IPv6 interface.
-    # Gunicorn can bind multiple addresses, see https://docs.gunicorn.org/en/stable/settings.html#bind.
-    options = [
-        GunicornOption("bind", f"0.0.0.0:{worker_log_server_port}"),
-        GunicornOption("bind", f"[::]:{worker_log_server_port}"),
-        GunicornOption("workers", 2),
-    ]
+    # If dual stack is available and IPV6_V6ONLY is not enabled on the socket
+    # then when IPV6 is bound to it will also bind to IPV4 automatically
+    if getattr(socket, "has_dualstack_ipv6", False)():

Review Comment:
   Oh, I see what was going on, sorry. I think this is clearer.
   ```suggestion
       if getattr(socket, "has_dualstack_ipv6", lambda: False)():
   ```



-- 
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] ashb merged pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

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


-- 
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] notatallshaw-work commented on a diff in pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

Posted by GitBox <gi...@apache.org>.
notatallshaw-work commented on code in PR #26222:
URL: https://github.com/apache/airflow/pull/26222#discussion_r965326586


##########
airflow/utils/serve_logs.py:
##########
@@ -38,6 +40,15 @@
 logger = logging.getLogger(__name__)
 
 
+def has_dualstack_ipv6():
+    """
+    Method to check if dual stack is supported was added in Python 3.8
+    """
+    if hasattr(socket, 'has_dualstack_ipv6'):
+        return socket.has_dualstack_ipv6()
+    return False

Review Comment:
   Sure, changed



-- 
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 #26222: Only bind to IPV6 when dual stack is available

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

   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] notatallshaw-work closed pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

Posted by GitBox <gi...@apache.org>.
notatallshaw-work closed pull request #26222: For worker log servers only bind to IPV6 when dual stack is available
URL: https://github.com/apache/airflow/pull/26222


-- 
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 #26222: For worker log servers only bind to IPV6 when dual stack is available

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

   Awesome work, congrats on your first merged pull request!
   


-- 
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] ashb commented on a diff in pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

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


##########
airflow/utils/serve_logs.py:
##########
@@ -143,13 +144,14 @@ def serve_logs():
 
     worker_log_server_port = conf.getint('logging', 'WORKER_LOG_SERVER_PORT')
 
-    # Make sure to have both an IPv4 and an IPv6 interface.
-    # Gunicorn can bind multiple addresses, see https://docs.gunicorn.org/en/stable/settings.html#bind.
-    options = [
-        GunicornOption("bind", f"0.0.0.0:{worker_log_server_port}"),
-        GunicornOption("bind", f"[::]:{worker_log_server_port}"),
-        GunicornOption("workers", 2),
-    ]
+    # If dual stack is available and IPV6_V6ONLY is not enabled on the socket
+    # then when IPV6 is bound to it will also bind to IPV4 automatically
+    if getattr(socket, "has_dualstack_ipv6", bool)():

Review Comment:
   ```suggestion
       if getattr(socket, "has_dualstack_ipv6", False)():
   ```



-- 
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] notatallshaw-work commented on pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

Posted by GitBox <gi...@apache.org>.
notatallshaw-work commented on PR #26222:
URL: https://github.com/apache/airflow/pull/26222#issuecomment-1239938887

   > Would it be viable to add a test for this?
   
   I think you would need to do a separate test run of the serve test logs with IPV6 disabled? I need to look at how Airflow organizes it's tests to see how easy that would be to 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] uranusjr commented on a diff in pull request #26222: For worker log servers only bind to IPV6 when dual stack is available

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


##########
airflow/utils/serve_logs.py:
##########
@@ -38,6 +40,15 @@
 logger = logging.getLogger(__name__)
 
 
+def has_dualstack_ipv6():
+    """
+    Method to check if dual stack is supported was added in Python 3.8
+    """
+    if hasattr(socket, 'has_dualstack_ipv6'):
+        return socket.has_dualstack_ipv6()
+    return False

Review Comment:
   Since this function is used only once, itโ€™s probably easier to just do
   
   ```python
   if getattr(socket, "has_dualstack_ipv6", bool)():
       ...
   ```
   
   instead.



-- 
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 #26222: For worker log servers only bind to IPV6 when dual stack is available

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

   Would it be viable to add a test for this?


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