Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Thread executor not executing task when debug is set to False

UPDATE_INTERVAL = 60 * 5

df = pd.read_csv('data.csv')

def fetch_data():
    global df
    df = pd.read_csv('data.csv')
    print(df['Value'])


def refresh_data(period=UPDATE_INTERVAL):
    """Update the data every 'period' seconds"""
    while True:
        print('Refreshing the data from server')
        fetch_data()
        time.sleep(period)


# Run the function in another thread
def initialize_executor():
    executor = ThreadPoolExecutor(max_workers=1)
    executor.submit(refresh_data)


app = dash.Dash(
    __name__,
    meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}],
)
app.config['suppress_callback_exceptions'] = True


def serve_layout():
    return html.Div(
        children=df['Name']
    )


app.layout = serve_layout

if __name__ == '__main__':
    initialize_executor()
    app.run_server(debug=False, host='127.0.0.1', port=8052)

I am trying to schedule data loading (from MySQL) with thread executor as shown in code above. However, the task is not executed when debug is set to false.

What am I doing wrong over here?