Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispyles committed Nov 11, 2021
2 parents 1c28347 + 5d5ba1b commit 119e239
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ daysUntilClose: 7
exemptLabels:
- pinned
- security
- TODO
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
Expand Down
17 changes: 8 additions & 9 deletions otter/check/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,26 @@ def save_notebook(filename, timeout=10):
Args:
filename (``str``): path to notebook file being saved
timeout (``int`` or ``float``): number of seconds to wait for save before timing-out
Returns
``bool``: whether the notebook was saved successfully
"""
timeout = timeout * 10**9
if get_ipython() is not None:
f = open(filename, "rb")
md5 = hashlib.md5(f.read()).hexdigest()
with open(filename, "rb") as f:
md5 = hashlib.md5(f.read()).hexdigest()
start = time.time_ns()
display(Javascript("Jupyter.notebook.save_checkpoint();"))

curr = md5
while curr == md5 and time.time_ns() - start <= timeout:
time.sleep(1)
f.seek(0)
curr = hashlib.md5(f.read()).hexdigest()

f.close()
with open(filename, "rb") as f:
curr = hashlib.md5(f.read()).hexdigest()


return curr != md5

return True


Expand Down

0 comments on commit 119e239

Please sign in to comment.