Skip to content

Commit

Permalink
Updates run_notebooks.py to give timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
frankharkins committed Jan 31, 2020
1 parent b89a54c commit 32537f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/run_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import time
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from datetime import datetime
filepath = "../content/"

def run_notebook(filename):
Expand All @@ -27,7 +28,7 @@ def run_notebook(filename):
ep = ExecutePreprocessor(timeout=None, kernel_name='python3')
ep.preprocess(nb, {'metadata': {'path': './'}})
except Exception as e:
print("** Error in file '", filename, "': ", str(e).split('\n')[-2])
print("[" + datetime.now().time().strftime('%H:%M') + "] " + "Error in file '", filename, "': ", str(e).split('\n')[-2])
execution_failed = True

if not execution_failed:
Expand All @@ -43,7 +44,7 @@ def run_notebook(filename):
if os.path.isdir(filepath + directory):
for file in os.listdir(filepath + directory):
if str(file)[-6:] == ".ipynb":
print(filepath + directory + "/" + file)
print("[" + datetime.now().time().strftime('%H:%M') + "] " + filepath + directory + "/" + file)
total_files += 1
if run_notebook(filepath + directory + "/" + file) == 1:
working_files += 1
Expand Down

0 comments on commit 32537f5

Please sign in to comment.