SamWheating edited a comment on pull request #17121:
URL: https://github.com/apache/airflow/pull/17121#issuecomment-908506290


   Yeah exactly, this might require some more changes, here's a shortened 
version of the relevant code from the rendering of the home page:
   
   ```python 
   
                dags_query = 
session.query(DagModel).filter(~DagModel.is_subdag, DagModel.is_active)    # 
deactivated DAGs filtered out here
           import_errors = 
session.query(errors.ImportError).order_by(errors.ImportError.id).all()
                all_dags = dags_query
           current_dags = all_dags
   
           dags = (
               current_dags.order_by(DagModel.dag_id)
               .options(joinedload(DagModel.tags))
               .offset(start)
               .limit(dags_per_page)
               .all()
           )
   
           if import_errors:
               dag_filenames = {dag.fileloc for dag in dags}
               all_dags_readable = (permissions.ACTION_CAN_READ, 
permissions.RESOURCE_DAG) in user_permissions
   
               for import_error in import_errors:
                   if all_dags_readable or import_error.filename in 
dag_filenames:              # dag_filenames only includes active DAGs
                       flash(
                           "Broken DAG: [{ie.filename}] 
{ie.stacktrace}".format(ie=import_error),
                           "dag_import_error",
                       )
   ```
   
[source](https://github.com/apache/airflow/blob/e18b6a6d19f9ea0d8fe760ba00adf38810f0e510/airflow/www/views.py#L541)
   
   So if a user does not have access to read all DAGs, they won't see 
importErrors for any DAGs since a DAG which begins throwing importErrors will 
be marked inactive 🤔 This definitely isn't the desired behaviour. 
   
   I guess the fix here would be to populate `dag_filenames` from a separate 
query which includes deactivated DAGs? Let me know if you have any suggestions. 


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