-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jupyter investigation to close any open h5 file handles so not to reu…
…se old data
- Loading branch information
1 parent
65eda4c
commit 9b54bf9
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
# https://stackoverflow.com/a/40222538/795574 | ||
|
||
# exit_register runs at the end of ipython %run or the end of the python interpreter | ||
try: | ||
def exit_register(fun, *args, **kwargs): | ||
""" Decorator that registers at post_execute. After its execution it | ||
unregisters itself for subsequent runs. """ | ||
def callback(): | ||
fun() | ||
ip.events.unregister('post_execute', callback) | ||
ip.events.register('post_execute', callback) | ||
|
||
|
||
ip = get_ipython() | ||
except NameError: | ||
from atexit import register as exit_register | ||
|
||
|
||
# @exit_register | ||
# def callback(): | ||
# print('I\'m done!') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters