zachliu commented on issue #23512:
URL: https://github.com/apache/airflow/issues/23512#issuecomment-1140160062

   both
   
https://github.com/apache/airflow/blob/ee100a592e07761f3b32294f3ad82c4a6c7cf74d/airflow/www/app.py#L136
   and
   
https://github.com/apache/airflow/blob/ee100a592e07761f3b32294f3ad82c4a6c7cf74d/airflow/www/app.py#L146
   are doing redundant reads/writes to the database once this line
   
https://github.com/apache/airflow/blob/ee100a592e07761f3b32294f3ad82c4a6c7cf74d/airflow/cli/commands/webserver_command.py#L475
   spins up 4 (by default) gunicorn workers. so i guess if i do this
   ```python
               os.environ['SKIP_DAGS_PARSING'] = 'True'
               app = create_app(None)
               os.environ.pop('SKIP_DAGS_PARSING')
   
               # set webserver.update_fab_perms to "False" here 
               # would cause the workers not to do the clashing reads/writes
   
               with subprocess.Popen(run_args, close_fds=True) as 
gunicorn_master_proc:
                   monitor_gunicorn(gunicorn_master_proc.pid)
   ```
   i know it's weird to alter it on the fly. an alternative is to set an env 
var such as
   ```python
   os.environ['UPDATE_FAB_PERMS_DONE'] = 'True'
   ```
   and then check it along side with `webserver.update_fab_perms` in 
https://github.com/apache/airflow/blob/ee100a592e07761f3b32294f3ad82c4a6c7cf74d/airflow/www/app.py#L67
 and 
https://github.com/apache/airflow/blob/ee100a592e07761f3b32294f3ad82c4a6c7cf74d/airflow/www/extensions/init_appbuilder.py#L643
   
   i tried the env var solution, it worked. but it's janky. it requires an 
extra env var :thinking: 


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to