I don't know why I'm having such a problem with this, basically, I want to have a Queue that is constantly running during the program called "Worker" this then works, however, every 10 seconds or so.. Another method called "Process" comes in and processes the data. Let's assume the following, data is captured every 10 seconds.. (0, 1, 2, 3, ..... n) and then the "Proces" function receives this, processes the data, ends, and then the "Worker" goes back to work and does their job until the program has ended.
I have the following code:
import multiprocessing as mp import time DELAY_SIZE = 10 def Worker(q): print "I'm working..." def Process(q): print "I'm processing.." queue = mp.Queue(maxsize=DELAY_SIZE) p = mp.Process(target=Worker, args=(queue,)) p.start() while True: d = queue.get() time.sleep(10) Process()
In this example, it would look like the following:
I'm working... I'm working... I'm working... ... ... ... I'm working... I'm processing... I'm processing... I'm processing... ... ... I'm working.. I'm working..