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 2020/06/26 13:53:14 UTC

[GitHub] [airflow] christophlingg opened a new pull request #9535: boolean values in environment variables

christophlingg opened a new pull request #9535:
URL: https://github.com/apache/airflow/pull/9535


   Some configuration variables are boolean and it was not clear to me how to set those bools from environmental variables which are all string. Eventually, I found the mapping in [the code](source https://github.com/apache/airflow/blob/master/airflow/configuration.py#L329-L341).
   
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [ x] Description above provides context of the change
   - [ ] Unit tests coverage for changes (not needed for documentation changes)
   - [ ] Target Github ISSUE in description if exists
   - [ ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [ ] Relevant documentation is updated including usage instructions.
   - [ ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   


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

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



[GitHub] [airflow] boring-cyborg[bot] commented on pull request #9535: boolean values in environment variables

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


   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/master/CONTRIBUTING.rst)
   Here are some useful points:
   - Pay attention to the quality of your code (flake8, pylint and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/master/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/master/docs/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/master/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/master/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://apache-airflow-slack.herokuapp.com/
   


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

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



[GitHub] [airflow] kaxil commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446945448



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       Even `tRuE` should work :) as we convert them to `.lower()` so it doesn't matter for a user until there is a Typo :)
   
   If you think some docs around that can help ease the confusion, I am happy for you to update the docs in this PR and merge 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.

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



[GitHub] [airflow] kaxil commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446350253



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       It shouldn't matter. the values are read as string by the configparser




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

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



[GitHub] [airflow] christophlingg commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
christophlingg commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446802187



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       thanks @kaxil for getting into that. When I set the environmental variables I was not aware that airflow parses booleans that gracefully and supports many variants (`1`, `TRUE`, `true`, `t`, `True`, ...). One could avoid concerns by giving an example in the documentation, like I did above.




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

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



[GitHub] [airflow] kaxil commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446353675



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       ```python
   ❯ export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=True
   ❯ ipython
   Python 3.7.4 (default, Aug 13 2019, 15:17:50)
   Type 'copyright', 'credits' or 'license' for more information
   IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.
   
   In [1]: from airflow.configuration import  conf
   
   In [2]: conf.getboolean("core", "load_default_connections")
   Out[2]: True
   
   In [3]:
   Do you really want to exit ([y]/n)? y
   ❯ export AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=False
   ❯ ipython
   Python 3.7.4 (default, Aug 13 2019, 15:17:50)
   Type 'copyright', 'credits' or 'license' for more information
   IPython 7.8.0 -- An enhanced Interactive Python. Type '?' for help.
   
   In [1]: from airflow.configuration import  conf
   
   In [2]: conf.getboolean("core", "load_default_connections")
   Out[2]: False
   
   In [3]:
   ```




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

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



[GitHub] [airflow] christophlingg closed pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
christophlingg closed pull request #9535:
URL: https://github.com/apache/airflow/pull/9535


   


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

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



[GitHub] [airflow] christophlingg commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
christophlingg commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r448213603



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       Maybe I was thinking too much like a software developer here. And as the parsing is so clever, people won't have issues. 
   
   I will close the PR, thanks for your feedback.




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

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



[GitHub] [airflow] kaxil commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446354134



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       Check line L330 
   
   
   https://github.com/apache/airflow/blob/096f5c5cba963b364ee75f6686d128cd4d34d66e/airflow/configuration.py#L329-L341




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

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



[GitHub] [airflow] kaxil commented on a change in pull request #9535: boolean values in environment variables

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #9535:
URL: https://github.com/apache/airflow/pull/9535#discussion_r446354134



##########
File path: docs/howto/set-config.rst
##########
@@ -37,6 +37,12 @@ or by creating a corresponding environment variable:
 .. code-block:: bash
 
     export AIRFLOW__CORE__SQL_ALCHEMY_CONN=my_conn_string
+    
+For setting boolean configuration values use ``true``/``false``:
+
+.. code-block:: bask
+
+    export AIRFLOW__CORE__REMOTE_LOGGING=true

Review comment:
       Check https://github.com/apache/airflow/blob/096f5c5cba963b364ee75f6686d128cd4d34d66e/airflow/configuration.py#L330




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

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