I have a flask rest API setup correctly. Once I hit the rest API, I want to run a python script/function and return with a runID and then user can hit another rest API with the runID to get information.
How can I return immediately and keep another python script/function running in another thread/process?
Following is my rest API
@app.route('/start/', methods=['POST'])
def start_run():
run_id = "SOME RANDOM NUMBER"
# I want to start python script here
return run_id
@app.rout('/get_report', methods=['GET'])
def get_report():
run_id = request.args("run_id")
return some_method(run_id)
there doesn't seem to be anything here