Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/notebook_validation.py: update nbconvert logs #2703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/notebook_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def execute(notebook_filename):
],
check=True)
elapsed = time.perf_counter() - start_time
print(f"Time taken for nbconvert: {elapsed:.2f} seconds")
print(
f"Time taken for nbconvert : {elapsed:.2f} seconds for '{notebook_filename}'"
)
os.remove(notebook_filename_out)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to remove this _out file in the except block if there is an error while running nbconvert?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. I think it won't help much for simply timing out but if an actual error occurs it could be nice to know how long it took to hit the error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh you mean remove the file itself, my brain for some reason was thinking you were asking for the timing as well for an error, which thinking about it could be helpful too :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:). Yes, we can add finally block here (and add os.remove in it) which can clean this file.

return True
except subprocess.CalledProcessError:
Expand Down