'how to access a dag file which is not visible in the ui

from airflow import DAG
from airflow.operators.python_operator import PythonOperator

def print_hello():
    return 'Hello world from first Airflow DAG!'

dag = DAG('hello_world', description='Hello World DAG',
          schedule_interval='0 12 * * *',
          start_date=datetime(2017, 3, 20), catchup=False)

hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)

hello_operator

I tried this sample code available online to learn how the dags work and to how to use airflow UI but the dag is not showing up in the UI when tried the scheduler it show this

 ____    |__( )_________  __/__  /________      __
____  /| |_  /__  ___/_  /_ __  /_  __ \_ | /| / /
___  ___ |  / _  /   _  __/ _  / / /_/ /_ |/ |/ /
 _/_/  |_/_/  /_/    /_/    /_/  \____/____/|__/
[2022-03-04 17:27:02 +0530] [2009] [INFO] Starting gunicorn 20.1.0
[2022-03-04 17:27:02 +0530] [2009] [ERROR] Connection in use: ('0.0.0.0', 8793)
[2022-03-04 17:27:02 +0530] [2009] [ERROR] Retrying in 1 second.
[2022-03-04 17:27:02,613] {scheduler_job.py:619} INFO - Starting the scheduler
[2022-03-04 17:27:02,615] {scheduler_job.py:624} INFO - Processing each file at most -1 times
[2022-03-04 17:27:02,630] {manager.py:163} INFO - Launched DagFileProcessorManager with pid: 2010
[2022-03-04 17:27:02,636] {scheduler_job.py:1137} INFO - Resetting orphaned tasks for active dag runs
[2022-03-04 17:27:02,647] {settings.py:55} INFO - Configured default timezone Timezone('UTC')
[2022-03-04 17:27:02,682] {manager.py:441} WARNING - Because we cannot use more than 1 thread (parsing_processes = 2) when using sqlite. So we set parallelism to 1.
[2022-03-04 17:27:03 +0530] [2009] [ERROR] Connection in use: ('0.0.0.0', 8793)
[2022-03-04 17:27:03 +0530] [2009] [ERROR] Retrying in 1 second.
[2022-03-04 17:27:04 +0530] [2009] [ERROR] Connection in use: ('0.0.0.0', 8793)
[2022-03-04 17:27:04 +0530] [2009] [ERROR] Retrying in 1 second.
[2022-03-04 17:27:05 +0530] [2009] [ERROR] Connection in use: ('0.0.0.0', 8793)
[2022-03-04 17:27:05 +0530] [2009] [ERROR] Retrying in 1 second.
[2022-03-04 17:27:06 +0530] [2009] [ERROR] Connection in use: ('0.0.0.0', 8793)
[2022-03-04 17:27:06 +0530] [2009] [ERROR] Retrying in 1 second.
[2022-03-04 17:27:07 +0530] [2009] [ERROR] Can't connect to ('0.0.0.0', 8793)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source