You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ryan Vandersmith (Jira)" <ji...@apache.org> on 2019/11/07 19:35:00 UTC

[jira] [Updated] (AIRFLOW-5867) [--debug] unit_test_mode configuration interpreted as str instead of bool

     [ https://issues.apache.org/jira/browse/AIRFLOW-5867?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan Vandersmith updated AIRFLOW-5867:
--------------------------------------
    Description: 
Relevant StackOverflow question:

[https://stackoverflow.com/questions/58366469/what-is-an-efficient-way-to-develop-airflow-plugins-without-restarting-the-web]

 

The `--debug` CLI argument appears to have unintended functionality:

[https://github.com/apache/airflow/blob/master/airflow/bin/cli.py#L980]
{code:python}
if args.debug:
        print(
            "Starting the web server on port {0} and host {1}.".format(
                args.port, args.hostname))
        app, _ = create_app(None, testing=conf.get('core', 'unit_test_mode'))
        app.run(debug=True, use_reloader=not app.config['TESTING'],
                port=args.port, host=args.hostname,
                ssl_context=(ssl_cert, ssl_key) if ssl_cert and ssl_key else None)
{code}
Because `testing` and consequently `app.config['TESTING']` are provided as a `str` object, the reloader is only enabled when the `unit_test_mode` property is an empty string. 

A very clean fix exists (line 979):
{code:java}
app, _ = create_app(None, testing=conf.getboolean('core', 'unit_test_mode'))
{code}
I will submit a pull request with the above change immediately after opening this issue. 

  was:
The `--debug` CLI argument appears to have unintended functionality:

[https://github.com/apache/airflow/blob/master/airflow/bin/cli.py#L980]
{code:python}
if args.debug:
        print(
            "Starting the web server on port {0} and host {1}.".format(
                args.port, args.hostname))
        app, _ = create_app(None, testing=conf.get('core', 'unit_test_mode'))
        app.run(debug=True, use_reloader=not app.config['TESTING'],
                port=args.port, host=args.hostname,
                ssl_context=(ssl_cert, ssl_key) if ssl_cert and ssl_key else None)
{code}
Because `testing` and consequently `app.config['TESTING']` are provided as a `str` object, the reloader is only enabled when the `unit_test_mode` property is an empty string. 

A very clean fix exists (line 979):
{code:java}
app, _ = create_app(None, testing=conf.getboolean('core', 'unit_test_mode'))
{code}
I will submit a pull request with the above change immediately after opening this issue. 


> [--debug] unit_test_mode configuration interpreted as str instead of bool
> -------------------------------------------------------------------------
>
>                 Key: AIRFLOW-5867
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-5867
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: cli
>    Affects Versions: 1.10.6
>            Reporter: Ryan Vandersmith
>            Assignee: Ryan Vandersmith
>            Priority: Minor
>              Labels: easyfix, pull-request-available
>             Fix For: 1.10.7
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> Relevant StackOverflow question:
> [https://stackoverflow.com/questions/58366469/what-is-an-efficient-way-to-develop-airflow-plugins-without-restarting-the-web]
>  
> The `--debug` CLI argument appears to have unintended functionality:
> [https://github.com/apache/airflow/blob/master/airflow/bin/cli.py#L980]
> {code:python}
> if args.debug:
>         print(
>             "Starting the web server on port {0} and host {1}.".format(
>                 args.port, args.hostname))
>         app, _ = create_app(None, testing=conf.get('core', 'unit_test_mode'))
>         app.run(debug=True, use_reloader=not app.config['TESTING'],
>                 port=args.port, host=args.hostname,
>                 ssl_context=(ssl_cert, ssl_key) if ssl_cert and ssl_key else None)
> {code}
> Because `testing` and consequently `app.config['TESTING']` are provided as a `str` object, the reloader is only enabled when the `unit_test_mode` property is an empty string. 
> A very clean fix exists (line 979):
> {code:java}
> app, _ = create_app(None, testing=conf.getboolean('core', 'unit_test_mode'))
> {code}
> I will submit a pull request with the above change immediately after opening this issue. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)