Browse Source

!15149 fix queue.empty block for summary

From: @jiang-shuqiang
Reviewed-by: @wenkai_dist,@yelihua
Signed-off-by: @yelihua
pull/15149/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
bba0d05157
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      mindspore/train/summary/_writer_pool.py

+ 6
- 2
mindspore/train/summary/_writer_pool.py View File

@@ -16,6 +16,7 @@
import os
import time
import signal
import queue
from collections import deque

import psutil
@@ -108,14 +109,17 @@ class WriterPool(ctx.Process):
for plugin, data in deq.popleft().get():
self._write(plugin, data)

if not self._queue.empty():
action, data = self._queue.get()
try:
action, data = self._queue.get(block=False)
if action == 'WRITE':
deq.append(pool.apply_async(_pack_data, (data, time.time())))
elif action == 'FLUSH':
self._flush()
elif action == 'END':
break
except queue.Empty:
pass

for result in deq:
for plugin, data in result.get():
self._write(plugin, data)


Loading…
Cancel
Save