derektan commited on
Commit
0c5b121
·
1 Parent(s): d715de5

Attempt bugfix to render last img before task completion

Browse files
Files changed (3) hide show
  1. app.py +13 -1
  2. env.py +1 -1
  3. test_multi_robot_worker.py +0 -2
app.py CHANGED
@@ -242,7 +242,19 @@ def process_search_tta(
242
  _stop_thread(th)
243
  th.join(timeout=1)
244
 
245
- # Final emit after both finish
 
 
 
 
 
 
 
 
 
 
 
 
246
  yield gr.update(interactive=True), last_tta, last_no, gr.update(value="Done."), gr.update(value="Done.")
247
 
248
 
 
242
  _stop_thread(th)
243
  th.join(timeout=1)
244
 
245
+ # One last scan after both threads have finished to catch any frame
246
+ # that may have been written just before termination but after the last
247
+ # polling iteration.
248
+ for fp in sorted(glob.glob(os.path.join(gifs_dir_tta, "*.png")), key=lambda p: int(os.path.splitext(os.path.basename(p))[0])):
249
+ if fp not in sent_tta:
250
+ sent_tta.add(fp)
251
+ last_tta = fp
252
+ for fp in sorted(glob.glob(os.path.join(gifs_dir_no, "*.png")), key=lambda p: int(os.path.splitext(os.path.basename(p))[0])):
253
+ if fp not in sent_no:
254
+ sent_no.add(fp)
255
+ last_no = fp
256
+
257
+ # Final emit after both finish (and after final scan)
258
  yield gr.update(interactive=True), last_tta, last_no, gr.update(value="Done."), gr.update(value="Done.")
259
 
260
 
env.py CHANGED
@@ -835,7 +835,7 @@ class Env():
835
  self.num_targets_found, \
836
  len(self.target_positions),
837
  self.explored_rate*100,
838
- step,
839
  NUM_EPS_STEPS),
840
  y=0.94, # Closer to plot
841
  )
 
835
  self.num_targets_found, \
836
  len(self.target_positions),
837
  self.explored_rate*100,
838
+ step+1,
839
  NUM_EPS_STEPS),
840
  y=0.94, # Closer to plot
841
  )
test_multi_robot_worker.py CHANGED
@@ -322,8 +322,6 @@ class TestWorker:
322
  # )
323
 
324
  if done:
325
- # NOTE: Added to interface with app.py (Allow for last img to be rendered)
326
- time.sleep(5)
327
  break
328
 
329
  if self.tta:
 
322
  # )
323
 
324
  if done:
 
 
325
  break
326
 
327
  if self.tta: