From e7d5b16a6263297c61b44cb0851e9514a3c05efb Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 10:40:55 -0400 Subject: [PATCH 1/6] output-sanitize.cfg: add %%time output For error like: ``` 10:26:02 _ pavics-sdi-fix-regridding-nb-to-pass-jenkins/docs/source/notebooks/regridding.ipynb::Cell 9 _ 10:26:02 Notebook cell execution failed 10:26:02 Cell 9: Cell outputs differ 10:26:02 10:26:02 Input: 10:26:02 %%time 10:26:02 reg_cons = xe.Regridder(ds_in_crns, ds_tgt, 'conservative', filename='conservative_regridder.nc') 10:26:02 print(reg_cons) 10:26:02 10:26:02 # Regrid as before 10:26:02 sic_cons = reg_cons(ds_in_crns.siconc) 10:26:02 10:26:02 Traceback: 10:26:02 mismatch 'stdout' 10:26:02 10:26:02 assert reference_output == test_output failed: 10:26:02 10:26:02 'xESMF Regrid...ime: 4.84 s\n' == 'xESMF Regrid...ime: 5.19 s\n' 10:26:02 Skipping 269 identical leading characters in diff, use -v to show 10:26:02 - mes: user 5.04 s, sys: 148 ms, total: 5.19 s 10:26:02 ? ^ ^ ^^ ^ ^^ 10:26:02 + mes: user 4.74 s, sys: 110 ms, total: 4.84 s 10:26:02 ? ^ ^ ^^ ^ ^^ 10:26:02 - Wall time: 5.19 s 10:26:02 ? ^ ^^ 10:26:02 + Wall time: 4.84 s 10:26:02 ? ^ ^^ ``` --- notebooks/output-sanitize.cfg | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index feacc8eb..c6cb6405 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -98,3 +98,13 @@ replace: /tmpRANDOM.png # Downloading to /tmp/tmp_v07l0_1/slp.2001_bbox_subset.nc. regex: /tmp[a-zA-Z0-9_]{8}/ replace: /tmpRANDOM/ + +[percent-percent-time-output-cpu-times] +# CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s +regex: CPU times:\s+\d+\.?\d*\s+[a-z]+,\s+sys:\s+\d+\.?\d*\s+[a-z]+,\s+total:\s+\d+\.?\d*\s+[a-z]+ +replace: CPU times: NUM s, sys: NUM s, total: NUM s + +[percent-percent-time-output-wall-time] +# Wall time: 4.84 s +regex: Wall time:\s+\d+\.?\d*\s+[a-z]+ +replace: Wall time: NUM s From a355051601823e6b0324d543b5091e776d9e3bc0 Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 10:54:44 -0400 Subject: [PATCH 2/6] output-sanitize.cfg: have to escape the comma as well Note Wall time was replaced correctly. ``` 10:46:14 assert reference_output == test_output failed: 10:46:14 10:46:14 'xESMF Regrid...time: NUM s\n' == 'xESMF Regrid...time: NUM s\n' 10:46:14 Skipping 272 identical leading characters in diff, use -v to show 10:46:14 - : user 4.75 s, sys: 167 ms, total: 4.92 s 10:46:14 ? ^ ^^ ^^ 10:46:14 + : user 4.74 s, sys: 110 ms, total: 4.84 s 10:46:14 ? ^ ^^ ^^ 10:46:14 Wall time: NUM s ``` --- notebooks/output-sanitize.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index c6cb6405..ece4b2eb 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -101,7 +101,7 @@ replace: /tmpRANDOM/ [percent-percent-time-output-cpu-times] # CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s -regex: CPU times:\s+\d+\.?\d*\s+[a-z]+,\s+sys:\s+\d+\.?\d*\s+[a-z]+,\s+total:\s+\d+\.?\d*\s+[a-z]+ +regex: CPU times:\s+\d+\.?\d*\s+[a-z]+\,\s+sys:\s+\d+\.?\d*\s+[a-z]+\,\s+total:\s+\d+\.?\d*\s+[a-z]+ replace: CPU times: NUM s, sys: NUM s, total: NUM s [percent-percent-time-output-wall-time] From 5f7f237ad45224ec246a211e0a09f25e163ba20b Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 11:04:38 -0400 Subject: [PATCH 3/6] output-sanitize.cfg: lower restriction for %%time regex, hopefully it works this time Note Wall time worked: ``` 10:59:16 assert reference_output == test_output failed: 10:59:16 10:59:16 'xESMF Regrid...time: NUM s\n' == 'xESMF Regrid...time: NUM s\n' 10:59:16 Skipping 269 identical leading characters in diff, use -v to show 10:59:16 - mes: user 5.67 s, sys: 172 ms, total: 5.85 s 10:59:16 ? ^ - ^^ ^ ^ 10:59:16 + mes: user 4.74 s, sys: 110 ms, total: 4.84 s 10:59:16 ? ^ + ^^ ^ ^ 10:59:16 Wall time: NUM s ``` --- notebooks/output-sanitize.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index ece4b2eb..50574531 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -101,7 +101,7 @@ replace: /tmpRANDOM/ [percent-percent-time-output-cpu-times] # CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s -regex: CPU times:\s+\d+\.?\d*\s+[a-z]+\,\s+sys:\s+\d+\.?\d*\s+[a-z]+\,\s+total:\s+\d+\.?\d*\s+[a-z]+ +regex: CPU times:\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+ replace: CPU times: NUM s, sys: NUM s, total: NUM s [percent-percent-time-output-wall-time] From df31145f508a7f76b434979122c511112444e444 Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 11:12:09 -0400 Subject: [PATCH 4/6] output-sanitize.cfg: oops missing 'user' in %%time regex, wonder why it wasn't working --- notebooks/output-sanitize.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index 50574531..936dc87a 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -101,7 +101,7 @@ replace: /tmpRANDOM/ [percent-percent-time-output-cpu-times] # CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s -regex: CPU times:\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+ +regex: CPU times:\s+user\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+ replace: CPU times: NUM s, sys: NUM s, total: NUM s [percent-percent-time-output-wall-time] From 23e7d9e5f9fcee2dc646dadd58fa5165d6c3ecee Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 11:17:05 -0400 Subject: [PATCH 5/6] output-sanitize.cfg: need to match the entire line of %%time output Note replacement worked but did not match until the end: ``` 11:15:40 assert reference_output == test_output failed: 11:15:40 11:15:40 'xESMF Regrid...time: NUM s\n' == 'xESMF Regrid...time: NUM s\n' 11:15:40 Skipping 296 identical leading characters in diff, use -v to show 11:15:40 - al: NUM s.19 s 11:15:40 ? ^^ 11:15:40 + al: NUM s.84 s 11:15:40 ? ^^ 11:15:40 Wall time: NUM s ``` --- notebooks/output-sanitize.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index 936dc87a..496cc960 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -101,7 +101,7 @@ replace: /tmpRANDOM/ [percent-percent-time-output-cpu-times] # CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s -regex: CPU times:\s+user\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+ +regex: CPU times:\s+user\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+\.?\d*\s+[a-z]+ replace: CPU times: NUM s, sys: NUM s, total: NUM s [percent-percent-time-output-wall-time] From 14ff49ed3f438760b18b75ff243eeb3db87d6e1d Mon Sep 17 00:00:00 2001 From: Long Vu Date: Tue, 16 Mar 2021 12:02:58 -0400 Subject: [PATCH 6/6] output-sanitize.cfg: nicer to match the replace string with real string (forgot 'user') --- notebooks/output-sanitize.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/output-sanitize.cfg b/notebooks/output-sanitize.cfg index 496cc960..96d738a1 100644 --- a/notebooks/output-sanitize.cfg +++ b/notebooks/output-sanitize.cfg @@ -102,7 +102,7 @@ replace: /tmpRANDOM/ [percent-percent-time-output-cpu-times] # CPU times: user 4.74 s, sys: 110 ms, total: 4.84 s regex: CPU times:\s+user\s+\d+.+\,\s+sys:\s+\d+.+\,\s+total:\s+\d+\.?\d*\s+[a-z]+ -replace: CPU times: NUM s, sys: NUM s, total: NUM s +replace: CPU times: user NUM s, sys: NUM s, total: NUM s [percent-percent-time-output-wall-time] # Wall time: 4.84 s