0

I have created a custom view in airflow 1.10.12. when I try to open the page, I get the following error in web.

Traceback (most recent call last):
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask_admin/base.py", line 69, in inner
    return self._run_view(f, *args, **kwargs)
  File "/home/deploy/airflow_env/lib/python3.7/site-packages/flask_admin/base.py", line 368, in _run_view
    return fn(self, *args, **kwargs)
  File "/home/deploy/airflow/plugins/views/backfill_view.py", line 14, in base
    dags=self._get_dag_names()
  File "/home/deploy/airflow/plugins/views/backfill_view.py", line 66, in _get_dag_names
    'airflow list_dags', shell=True
  File "/usr/lib/python3.7/subprocess.py", line 411, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'airflow list_dags' returned non-zero exit status 120.

this is the code piece from backfill_view.py line 66

dags_raw = subprocess.check_output(
    'airflow list_dags', shell=True
).split()

I'm able to run airflow list_dags directly from the server. I couldn't find the right solution. I'd appreciate it if anyone could help with this.

Apache Airflow [1.10.12]
Platform: [Linux, x86_64]
Python Version: [3.7.3]
  • The `check` part of the name specifically says to fail if the subprocess failed. Why it fails has nothing with your Python code to do; voting to close as lacking debugging details. – tripleee Sep 21 '22 at 09:52
  • As an aside, you'll want to refactor to avoid the unnecessary `shell=True`. See also [Actual meaning of `shell=True` in `subprocess`](https://stackoverflow.com/questions/3172470/actual-meaning-of-shell-true-in-subprocess) – tripleee Sep 21 '22 at 09:53

0 Answers0