'non-blocking progress-update in jupyter cell with multiprocessing
I run my cell, spawn a process and share a variable 'counter' between the 2 processes:
import multiprocessing as mp
import helper as hp
if __name__ == '__main__':
counter = mp.Value('i',0)
p1 = mp.Process(target=hp.calc_returns, args=(2020, counter), name='p1')
p1.start()
when a 'sub-task' is completed in hp.calc_returns, counter gets incremented:
with counter.get_lock():
counter.value += 1
I can access its value in my parent process.
I want to autonomously update this jupyter-cell, so that i can keep working in the notebook below and come back from time to time and check how much work has been down, without running the cell manually
Do i need to spawn a 2nd process to keep updating this cell or how would one go about it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
