docs/notebook_validation.py: update nbconvert logs
Improve the timing logs for the docker container validation during nbconvert.
This is because in CI, the list of timings is printed after the nbconvert is done, so you see something like:
...
[NbConvertApp] Converting notebook applications/python/readout_error_mitigation.ipynb to notebook
[NbConvertApp] Writing 187307 bytes to applications/python/readout_error_mitigation.nbconvert.ipynb
[NbConvertApp] Converting notebook applications/python/deutsch_jozsa.ipynb to notebook
[NbConvertApp] Writing 10396 bytes to applications/python/deutsch_jozsa.nbconvert.ipynb
Time taken for nbconvert: 6.10 seconds
Time taken for nbconvert: 7.83 seconds
Time taken for nbconvert: 10.72 seconds
Time taken for nbconvert: 3.18 seconds
Time taken for nbconvert: 7.33 seconds
...
See: https://github.com/NVIDIA/cuda-quantum/actions/runs/13690948087/job/38285994246#step:5:1387
Which makes it hard to see what took a long time.
This pull request requires additional validation before any workflows can run on NVIDIA's runners.
Pull request vetters can view their responsibilities here.
Contributors can view more details about this message here.
Let's hold off on merging this in, there's some higher priority PRs in the pipeline for release.
@mitchdz Is this PR good to go now?
Let's send it.
Actually let me add your suggestion real quick since we don't have a release to squeeze this into.
There we go. Added the os.remove into a finally block.
/ok to test
Command Bot: Processing...
CUDA Quantum Docs Bot: A preview of the documentation can be found here.
Thanks @mitchdz. Mind adding the output of validation script in the description. So that it is easy to see before and after.
Sure thing. It outputs a little differently in the terminal when ran manually due to how the github logs run, but here's a manual run:
$ docker run --rm --gpus all --network host -it -v /home/mdzurick:/host/ nvcr.io/nvidia/quantum/cuda-quantum:cu12-0.10.0
$ git clone https://github.com/mitchdz/cuda-quantum.git -b mitch/update-docker-validation-logs
$ cd cuda-quantum/docs
# modify notebook_validation.py to use notebook_filenames = ['sphinx/applications/python/hybrid_qnns.ipynb', 'sphinx/applications/python/qaoa.ipynb', 'sphinx/applications/python/deutschs_algorithm.ipynb', 'sphinx/applications/python/quantum_transformer.ipynb']
$ cudaq@2570547-lcedt:~/cuda-quantum/docs$ echo "nvidia" | python3 notebook_validation.py
[NbConvertApp] Converting notebook sphinx/applications/python/qaoa.ipynb to notebook
[NbConvertApp] Writing 20945 bytes to sphinx/applications/python/qaoa.nbconvert.ipynb
Time taken for nbconvert : 2.97 seconds for 'sphinx/applications/python/qaoa.ipynb'
[NbConvertApp] Converting notebook sphinx/applications/python/deutschs_algorithm.ipynb to notebook
[NbConvertApp] Writing 16516 bytes to sphinx/applications/python/deutschs_algorithm.nbconvert.ipynb
Time taken for nbconvert : 2.58 seconds for 'sphinx/applications/python/deutschs_algorithm.ipynb'
Success! The following notebook(s) executed successfully:
sphinx/applications/python/qaoa.ipynb sphinx/applications/python/deutschs_algorithm.ipynb
::warning::Skipped validation for the following notebook(s):
quantum_transformer.ipynb hybrid_qnns.ipynb
In the github CI/CD logs, it will look like this:
[NbConvertApp] Converting notebook sphinx/applications/python/qaoa.ipynb to notebook
[NbConvertApp] Writing 20945 bytes to sphinx/applications/python/qaoa.nbconvert.ipynb
[NbConvertApp] Converting notebook sphinx/applications/python/deutschs_algorithm.ipynb to notebook
[NbConvertApp] Writing 16516 bytes to sphinx/applications/python/deutschs_algorithm.nbconvert.ipynb
Time taken for nbconvert : 2.97 seconds for 'sphinx/applications/python/qaoa.ipynb'
Time taken for nbconvert : 2.58 seconds for 'sphinx/applications/python/deutschs_algorithm.ipynb'
Success! The following notebook(s) executed successfully:
sphinx/applications/python/qaoa.ipynb sphinx/applications/python/deutschs_algorithm.ipynb
::warning::Skipped validation for the following notebook(s):
quantum_transformer.ipynb hybrid_qnns.ipynb
In the github CI/CD logs, it will look like this:
[NbConvertApp] Converting notebook sphinx/applications/python/qaoa.ipynb to notebook [NbConvertApp] Writing 20945 bytes to sphinx/applications/python/qaoa.nbconvert.ipynb [NbConvertApp] Converting notebook sphinx/applications/python/deutschs_algorithm.ipynb to notebook [NbConvertApp] Writing 16516 bytes to sphinx/applications/python/deutschs_algorithm.nbconvert.ipynb Time taken for nbconvert : 2.97 seconds for 'sphinx/applications/python/qaoa.ipynb' Time taken for nbconvert : 2.58 seconds for 'sphinx/applications/python/deutschs_algorithm.ipynb' Success! The following notebook(s) executed successfully: sphinx/applications/python/qaoa.ipynb sphinx/applications/python/deutschs_algorithm.ipynb ::warning::Skipped validation for the following notebook(s): quantum_transformer.ipynb hybrid_qnns.ipynb
Just a question, can we make it like this one?
[NbConvertApp] Converting notebook sphinx/applications/python/qaoa.ipynb to notebook
[NbConvertApp] Writing 20945 bytes to sphinx/applications/python/qaoa.nbconvert.ipynb
Time taken for nbconvert : 2.97 seconds for 'sphinx/applications/python/qaoa.ipynb'
I'm not exactly sure why the output is buffered like that. I assume it is because the Github CI buffers the output of each command and the output of NBConvert separately.
At first I thought because it's parallel threaded, but that doesn't seem to be the case.
/ok to test
Command Bot: Processing...
CUDA Quantum Docs Bot: A preview of the documentation can be found here.
/ok to test 2791ccd
Command Bot: Processing...
CUDA Quantum Docs Bot: A preview of the documentation can be found here.
/ok to test
Command Bot: Processing...
/ok to test
@mitchdz, there was an error processing your request: E1
See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/
/ok to test 492d9826f746e1a1fb0691f0dfb0328377157712
Command Bot: Processing...
CUDA Quantum Docs Bot: A preview of the documentation can be found here.
Just a quick check. Are we now seeing the output in the following format?
[NbConvertApp] Converting notebook sphinx/applications/python/qaoa.ipynb to notebook
[NbConvertApp] Writing 20945 bytes to sphinx/applications/python/qaoa.nbconvert.ipynb
Time taken for nbconvert : 2.97 seconds for 'sphinx/applications/python/qaoa.ipynb'
Yes, it will look like that.
Yes, it will look like that.
If the output is same as the one above then we are good to go here.
/ok to test 98617ef
Command Bot: Processing...