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

CaSR_basic.ipynb: fix output to avoid breaking Jenkins #323

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

tlvu
Copy link
Contributor

@tlvu tlvu commented Mar 16, 2024

Add # NBVAL_IGNORE_OUTPUT to pass Jenkins. I think it's probably due to the usage of clear_output(). However removing clear_output() will make the output very long and messy. Have to take the lesser of the 2 evils.

New notebook introduced by #320.

Fix this error:

[2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 2 _______
[2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m
[2024-03-16T00:52:45.909Z] [94mCell 2: Cell outputs differ
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] Input:
[2024-03-16T00:52:45.909Z] [0mimport logging
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] from dask.distributed import Client
[2024-03-16T00:52:45.909Z] from IPython.display import clear_output
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # For hourly data, we suggest using the following chunking pattern: dict(time=720, rlon=50, rlat=50)
[2024-03-16T00:52:45.909Z] # Compute 10-year precipitation means. This is a lazy operation, no computations are done at this point.
[2024-03-16T00:52:45.909Z] pr10y = bbox.pr.resample(time="10YS").mean(dim="time", keep_attrs=True)
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Options for dask workers
[2024-03-16T00:52:45.909Z] dask_kwargs = dict(
[2024-03-16T00:52:45.909Z]     n_workers=8,
[2024-03-16T00:52:45.909Z]     threads_per_worker=6,
[2024-03-16T00:52:45.909Z]     memory_limit="2.5GB",
[2024-03-16T00:52:45.909Z]     local_directory="/notebook_dir/writable-workspace/tmp",
[2024-03-16T00:52:45.909Z]     silence_logs=logging.ERROR,
[2024-03-16T00:52:45.909Z] )
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Actually perform the computation
[2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c:
[2024-03-16T00:52:45.909Z]     clear_output()
[2024-03-16T00:52:45.909Z]     # Just taking the first 10-year average to speed things up
[2024-03-16T00:52:45.909Z]     pr10y = pr10y.isel(time=0).compute()
[2024-03-16T00:52:45.909Z] clear_output()
[2024-03-16T00:52:45.909Z] pr10y.plot()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] [94mTraceback:[0m
[2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call -----------------------------
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 3 _______
[2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m
[2024-03-16T00:52:45.909Z] [94mCell 3: Cell outputs differ
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] Input:
[2024-03-16T00:52:45.909Z] [0mfrom xclim import atmos
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Compute heat index using xclim and find the annual maxima.
[2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c:
[2024-03-16T00:52:45.909Z]     clear_output()
[2024-03-16T00:52:45.909Z]     hi_max = atmos.heat_index(ds=site).resample(time="Y").max()
[2024-03-16T00:52:45.909Z] clear_output()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Plot the results
[2024-03-16T00:52:45.909Z] hi_max.plot()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] [94mTraceback:[0m
[2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call -----------------------------
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output

Refresh using current production Jenkins env.

Fix this error:
```
[2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 2 _______
[2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m
[2024-03-16T00:52:45.909Z] [94mCell 2: Cell outputs differ
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] Input:
[2024-03-16T00:52:45.909Z] [0mimport logging
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] from dask.distributed import Client
[2024-03-16T00:52:45.909Z] from IPython.display import clear_output
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # For hourly data, we suggest using the following chunking pattern: dict(time=720, rlon=50, rlat=50)
[2024-03-16T00:52:45.909Z] # Compute 10-year precipitation means. This is a lazy operation, no computations are done at this point.
[2024-03-16T00:52:45.909Z] pr10y = bbox.pr.resample(time="10YS").mean(dim="time", keep_attrs=True)
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Options for dask workers
[2024-03-16T00:52:45.909Z] dask_kwargs = dict(
[2024-03-16T00:52:45.909Z]     n_workers=8,
[2024-03-16T00:52:45.909Z]     threads_per_worker=6,
[2024-03-16T00:52:45.909Z]     memory_limit="2.5GB",
[2024-03-16T00:52:45.909Z]     local_directory="/notebook_dir/writable-workspace/tmp",
[2024-03-16T00:52:45.909Z]     silence_logs=logging.ERROR,
[2024-03-16T00:52:45.909Z] )
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Actually perform the computation
[2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c:
[2024-03-16T00:52:45.909Z]     clear_output()
[2024-03-16T00:52:45.909Z]     # Just taking the first 10-year average to speed things up
[2024-03-16T00:52:45.909Z]     pr10y = pr10y.isel(time=0).compute()
[2024-03-16T00:52:45.909Z] clear_output()
[2024-03-16T00:52:45.909Z] pr10y.plot()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] [94mTraceback:[0m
[2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call -----------------------------
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] _______ pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb::Cell 3 _______
[2024-03-16T00:52:45.909Z] [91mNotebook cell execution failed[0m
[2024-03-16T00:52:45.909Z] [94mCell 3: Cell outputs differ
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] Input:
[2024-03-16T00:52:45.909Z] [0mfrom xclim import atmos
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Compute heat index using xclim and find the annual maxima.
[2024-03-16T00:52:45.909Z] with Client(**dask_kwargs) as c:
[2024-03-16T00:52:45.909Z]     clear_output()
[2024-03-16T00:52:45.909Z]     hi_max = atmos.heat_index(ds=site).resample(time="Y").max()
[2024-03-16T00:52:45.909Z] clear_output()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] # Plot the results
[2024-03-16T00:52:45.909Z] hi_max.plot()
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] [94mTraceback:[0m
[2024-03-16T00:52:45.909Z] [91mUnexpected output fields from running code: {'stderr'}[0m
[2024-03-16T00:52:45.909Z]
[2024-03-16T00:52:45.909Z] ----------------------------- Captured stdout call -----------------------------
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
[2024-03-16T00:52:45.909Z] unhandled iopub msg: clear_output
```
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tlvu
Copy link
Contributor Author

tlvu commented Mar 20, 2024

Finally have to add # NBVAL_IGNORE_OUTPUT to pass Jenkins. I think it's probably due to the usage of clear_output(). However removing clear_output() will make the output very long and messy. Have to take the lesser of the 2 evils.

@tlvu tlvu merged commit b52c4d0 into master Mar 20, 2024
2 checks passed
@tlvu tlvu deleted the fix-new-CaSR_basic-output-breaking-Jenkins branch March 20, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants