예제 #1
0
def run_downloading(server, markets):
	print 'downloading'
	rtopQueue = Queue()
	rtopLock = Lock()
	ptodQueue = Queue()
	ptodLock = Lock()
	dtopQueue = Queue()
	dtopLock = Lock()

	toExit = False

	receiverPs = Process(target = do_receive, args = (rtopQueue, rtopLock, toExit, server))
	preprocessorPs = Process(target = do_preprocess, args = (rtopQueue, rtopLock, ptodQueue, ptodLock, toExit, server))
	downloaderPs = Process(target = do_download, args = (ptodQueue, ptodLock, toExit, server))

	downloaderPs.start()
	preprocessorPs.start()
	receiverPs.start()

	run_downing(server, markets)

	#to exit
	time.sleep(60 * 5)
	toExit = True

	receiverPs.join()
	preprocessorPs.join()
	downloaderPs.join()
예제 #2
0
def run_downloading_forward(server, markets):
	toExit = False

	rtofQueue = Queue()
	rtofLock = Lock()

	receiverPs = Process(target = do_receive, args = (rtofQueue, rtofLock, toExit, server))
	forwarderPs = Process(target = do_forward, args = (rtofQueue, rtofLock, toExit, server))

	forwarderPs.start()
	receiverPs.start()

	time.sleep(15)

	run_downing(server, markets)

	time.sleep(60 * 5)
	toExit = True

	receiverPs.join()
	forwarderPs.join()