Lauch subprocess from flask and restart flask will kill the subprocess also.
someone know how can detach a process from the main process ? so if i kill the main process the subprocess will remain active ?
Es:
In the main flask app when i open a route, for example /store_changes the app run the code below:
subprocess.Popen("python hdb_store_changes.py --country {0} --id_first_level {1} --threads {2} --qty {3} --username {4}".format(country.upper(),id_first_level,threads,fixedqty,username), shell=True,stdout=subprocess.PIPE)
this code will execute another program that will takes long time to process... if i restart the flask app this process die also, i need to find a way to detach from the main process...
Thanks
The solution i adopted is to use celery as mentioned by wgwz
but the solution of J.F. Sebastian is correct also.