I am building a machine learning application with Dash Python. The main process is running the Dash app. From there, I can start the ML training via a button click. Clicking on the button starts a multiprocessing.Process()
to run the ML training. I am using a multiprocessing.Queue()
to send current training data to the Dash app.
I need to be able to terminate the training process and to close the queue when another button is clicked. In other words: I want to start and stop ML training as often as I want to, either starting a new multiprocessing.Process()
and multiprocessing.Queue()
or terminating/closing the currently running. Therefore, I am looking for a solution to store the multiprocessing.Process()
and the multipprocessing.Queue()
to be able to access them. However, this is not possible with dcc.Store
since both object types are not JSON serializable.
Using global variables is not an option as it is bad practice and I have to create the multiprocessing.process
dynamically with different parameters.
Is there any way to accomplish this?