def create_app(config_mapping=None): """Create REANA-Job-Controller application.""" logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT) app = Flask(__name__) app.secret_key = "mega secret key" app.session = Session app.config.from_object(config) if config_mapping: app.config.from_mapping(config_mapping) if "htcondorcern" in app.config["SUPPORTED_COMPUTE_BACKENDS"]: app.htcondor_executor = ThreadPoolExecutor(max_workers=1) with app.app_context(): app.config["OPENAPI_SPEC"] = build_openapi_spec() from reana_job_controller.rest import blueprint # noqa app.register_blueprint(blueprint, url_prefix="/") # Close session after each request app.teardown_request(shutdown_session) # Close session on app teardown app.teardown_appcontext(shutdown_session) return app
def create_app(JOB_DB=None, config_mapping=None): """Create REANA-Job-Controller application.""" logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT) app = Flask(__name__) app.secret_key = "mega secret key" app.config.from_object(config) if config_mapping: app.config.from_mapping(config_mapping) with app.app_context(): app.config['OPENAPI_SPEC'] = build_openapi_spec() from reana_job_controller.rest import blueprint # noqa app.register_blueprint(blueprint, url_prefix='/') return app
def create_app(JOB_DB=None, config_mapping=None): """Create REANA-Job-Controller application.""" logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT) app = Flask(__name__) app.secret_key = "mega secret key" app.config.from_object(config) if config_mapping: app.config.from_mapping(config_mapping) if 'htcondorcern' in app.config['SUPPORTED_COMPUTE_BACKENDS']: app.htcondor_executor = ThreadPoolExecutor(max_workers=1) with app.app_context(): app.config['OPENAPI_SPEC'] = build_openapi_spec() from reana_job_controller.rest import blueprint # noqa app.register_blueprint(blueprint, url_prefix='/') return app
def create_app(JOB_DB, watch_jobs=True): """Create REANA-Job-Controller application.""" logging.basicConfig( level=logging.DEBUG, format='%(asctime)s - %(threadName)s - %(levelname)s: %(message)s') app = Flask(__name__) app.secret_key = "mega secret key" app.config.from_object(config) with app.app_context(): app.config['OPENAPI_SPEC'] = build_openapi_spec() from reana_job_controller.rest import blueprint # noqa app.register_blueprint(blueprint, url_prefix='/') if watch_jobs: start_watch_jobs_thread(JOB_DB) return app