2 from ray.util.queue
import Queue
9 ray.init(dashboard_port=50051, num_cpus=8)
11 image_file=os.environ[
'cFpRootDir'] +
"ROLE/vision/hls/harris/test/512x512.png"
12 frame = cv.imread(image_file, cv.IMREAD_COLOR)
15 queue = Queue(maxsize=100)
19 next_item = queue.get(block=
True, timeout=100)
20 print(f
"will work on {next_item} and then put in back in the queue")
21 for l
in range(10000000):
23 frame_ret = cv.medianBlur(frame, 9)
28 consumers = [consumer.remote(i, queue, frame)
for i
in range(5)]
30 [queue.put(j)
for j
in ([[
"10.12.200.73" ,
"2718"],
31 [
"10.12.200.24" ,
"2719"],
32 [
"10.12.200.11" ,
"2720"],
33 [
"10.12.200.19" ,
"2721"],
34 [
"10.12.200.29" ,
"2722"]])]
37 results = ray.get(consumers)
38 print(
'Tasks executed')
40 for t
in range(len(results)):
41 file_out =
"/tmp/img_"+
str(t)+
".png"
42 cv.imwrite(file_out, results[t])
def consumer(i, queue, frame)