Skip to content

Conversation

@veugene
Copy link

@veugene veugene commented Aug 24, 2019

Heya, I noticed that I hit issue #108 when I encountered its side-effect of causing my script to hang on exit. To avoid a hang, the flusher thread no longer joins itself! However, since the thread is a daemon, some weakref.finalizer magic is used to wait for a clean shutdown of the thread and then have the event writer flush to disk, on exit. The finalizer uses a weak reference to the event writer so as to not prevent the writer (and thread) from being garbage collected before the end of the script.

Issue #108 shows that event files are not closed on exit. This is fixed here.

Eugene Vorontsov added 2 commits August 24, 2019 16:03
@veugene veugene mentioned this pull request Aug 24, 2019
@veugene
Copy link
Author

veugene commented Aug 24, 2019

Works for python 3 but the weakref API for python 2 doesn't have finalize. :(

It would be a shame to have to use a much uglier atexit hack to make this work with python 2. How much longer will this library support python 2?

@codecov-io
Copy link

codecov-io commented Aug 25, 2019

Codecov Report

Merging #498 into master will increase coverage by 0.01%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #498      +/-   ##
==========================================
+ Coverage   89.01%   89.03%   +0.01%     
==========================================
  Files          37       37              
  Lines        2576     2589      +13     
==========================================
+ Hits         2293     2305      +12     
- Misses        283      284       +1
Impacted Files Coverage Δ
tensorboardX/event_file_writer.py 94.91% <94.73%> (-0.33%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b9933a...102cdb6. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants