Skip to content

Commit

Permalink
Replace Flask with FastAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
frode-aarstad committed Nov 18, 2024
1 parent a02a486 commit af9f1af
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/everest/detached/jobs/everserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameOID
from dns import resolver, reversename
from flask import Flask, Response, jsonify, request
#from flask import Flask, Response, jsonify, request
import uvicorn

from fastapi import FastAPI, Request, status
from fastapi.responses import HTMLResponse, RedirectResponse, Response

from ropt.enums import OptimizerExitCode

from ert.config import QueueSystem
Expand Down Expand Up @@ -89,7 +94,7 @@ def _opt_monitor(shared_data=None):


def _everserver_thread(shared_data, server_config):
app = Flask(__name__)
app = FastAPI()

def check_user(password):
return password == server_config["authentication"]
Expand Down Expand Up @@ -149,7 +154,12 @@ def get_opt_progress():
server_config["key_path"],
server_config["key_passwd"],
)
app.run(host="0.0.0.0", port=server_config["port"], ssl_context=ctx)


uvicorn.run(app, host="0.0.0.0", port=server_config["port"])
#app.run(host="0.0.0.0", port=server_config["port"], ssl_context=ctx)




def _find_open_port(host, lower, upper):
Expand Down

0 comments on commit af9f1af

Please sign in to comment.