Skip to content

Commit

Permalink
Update Flask configuration for the scheduler (#43)
Browse files Browse the repository at this point in the history
Modify the start-up configuration to don't depend on environment variables to start the scheduler component.
  • Loading branch information
ggonzr authored Feb 21, 2024
1 parent 8d939cf commit ba6afe0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import logging
import json
import os
from flask import Flask, send_file, request, make_response
from flask_restful import Api
from environment import (
Expand Down Expand Up @@ -405,16 +404,13 @@ def main():
Main function, parse arguments, create a controller and start Flask web server
"""
set_app()
set_scheduler()
scheduler.start()
logger = logging.getLogger()

# Scheduler config - Flask
if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
set_scheduler()
scheduler.start()

logger.info("Will run on %s:%s", HOST, PORT)
try:
app.run(host=HOST, port=PORT, debug=DEBUG, threaded=True)
app.run(host=HOST, port=PORT, debug=DEBUG, use_reloader=False, threaded=True)
finally:
scheduler.stop()

Expand Down

0 comments on commit ba6afe0

Please sign in to comment.