Achtung! Help, I have a Flask server, whose main task, call in the system script with a parameter passed in the request. Here is the code:
from flask import Flask
from flask import Response
app = Flask(__name__)
cmd = './prg '
cmd = cmd + url
PIPE = subprocess.PIPE
p = subprocess.Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE,
stderr=subprocess.STDOUT, close_fds=True, cwd='/home/prog')
resp = Response(p.stdout.read())
resp.headers['Access-Control-Allow-Origin'] = '*'
if __name__ == "__main__":
context = ('/var/www/httpd-cert/www-root/cert.crt', '/var/www/httpd-cert/www-root/cert.key')
app.run(host='0.0.0.0', port=9090, ssl_context=context)</url>
Faced with a problem, my server crashes when it was accessed, what it can be connected? How to set this process optimally? It is worth noting that the program which is called computationally intensive, and runs not quite enough, using all available cores. (sometimes several minutes)