Hi!
We sometimes have Pull Requests which fail because of lengthy examples or unit tests. In this case, the continuous integration system generates a “timeout” because the maximum elapsed time of a Python script exceeds some threshold, say 100 seconds for example. This makes these scripts sensitive to many external events, such as the load of the machine where the script is executed. In this topic, I would like to discuss the methods we have to find these scripts using grep combined with awk, including ranking the output to get the scripts which execution takes longer.
Getting the raw log file
Within the PR, we search for the red cross:
We click on the “details”:
Finally, we can view the log. We can also view the raw logs:
I saved it into the job-logs.txt file.
Searching for timeout scripts
We can then search for the “timeout” keyword:
grep -r "Timeout" job-logs.txt
This produces:
$ grep -r "Timeout" job-logs.txt
2025-11-26T13:26:07.2985171Z 238/994 Test #930: pyinstallcheck_example_plot_chaos_cv .............................................***Timeout 100.02 sec
2025-11-26T13:27:47.3279178Z Test #930: pyinstallcheck_example_plot_chaos_cv .............................................***Timeout 100.03 sec
2025-11-26T13:33:53.6204796Z 649/994 Test #893: pyinstallcheck_example_plot_fieldfunction_metamodel ..............................***Timeout 100.03 sec
2025-11-26T13:35:33.6404820Z Test #893: pyinstallcheck_example_plot_fieldfunction_metamodel ..............................***Timeout 100.02 sec
2025-11-26T13:40:55.7008691Z 893 - pyinstallcheck_example_plot_fieldfunction_metamodel (Timeout)
2025-11-26T13:40:55.7009235Z 930 - pyinstallcheck_example_plot_chaos_cv (Timeout)
[...]
Search for the elapsed time of each script
We can use:
$ grep "Passed" job-logs.txt | sed 's/.*Test *#[0-9]\+: \([^ ]\+\) .* Passed *\([0-9.]\+\) sec/\1 : \2 sec/'
This produces:
$ grep "Passed" job-logs.txt | sed 's/.*Test *#[0-9]\+: \([^ ]\+\) .* Passed *\([0-9.]\+\) sec/\1 : \2 sec/'
pyinstallcheck_PythonFunction_save : 1.42 sec
pyinstallcheck_PythonPointToFieldFunction_save : 1.47 sec
pyinstallcheck_PythonDistribution_save : 0.36 sec
pyinstallcheck_PythonRandomVector_save : 0.34 sec
pyinstallcheck_CharlierFactory_std : 0.32 sec
pyinstallcheck_Dirac_std : 0.36 sec
[...]
Print the scripts and rank them starting from slowest
The command is:
$ grep "Passed" job-logs.txt | sed 's/.*Test *#[0-9]\+: \([^ ]\+\) .* Passed *\([0-9.]\+\) sec/\1 : \2 sec/' | sort -t: -k2 -rn
This produces:
$ grep "Passed" job-logs.txt | sed 's/.*Test *#[0-9]\+: \([^ ]\+\) .* Passed *\([0-9.]\+\) sec/\1 : \2 sec/' | sed 's/pyinstallcheck_//' | sort -t: -k2 -rn
FieldFunctionalChaosSobolIndices_std : 56.88 sec
FieldToPointFunctionalChaosAlgorithm_std : 55.94 sec
FunctionalChaosSobolIndices_std : 53.88 sec
LeastSquaresExpansion_std : 50.38 sec
example_plot_sensitivity_wingweight : 44.17 sec
example_plot_estimate_gpd_rain : 38.97 sec
[...]
Several of these scripts are related to the polynomial chaos expansion.
Here is the full list of files requiring more than 10 seconds.
| File | Elapsed time (sec) |
|---|---|
| example_plot_chaos_conditional_expectation | 80.67 |
| FieldFunctionalChaosSobolIndices_std | 56.88 |
| FieldToPointFunctionalChaosAlgorithm_std | 55.94 |
| FunctionalChaosSobolIndices_std | 53.88 |
| LeastSquaresExpansion_std | 50.38 |
| example_plot_sensitivity_wingweight | 44.17 |
| example_plot_estimate_gpd_rain | 38.97 |
| OptimizationAlgorithm_std | 38.45 |
| GeneralizedParetoFactory_std | 37.05 |
| example_plot_field_fca_sobol | 34.93 |
| FunctionalChaosValidation_std | 28.53 |
| TruncatedOverMesh_std | 26.70 |
| PointConditionalDistribution_std | 26.08 |
| example_plot_posterior_distribution | 23.96 |
| example_plot_gibbs | 20.09 |
| HSICEstimatorGlobalSensitivity_std | 19.50 |
| example_plot_functional_chaos | 18.55 |
| RandomMixture_std | 16.74 |
| example_plot_estimate_multivariate_distribution | 16.47 |
| MaximumEntropyOrderStatisticsDistribution_std | 16.11 |
| Student_std | 15.54 |
| FunctionalChaos_conditionalExpectation | 15.32 |
| MaximumDistribution_std | 15.12 |
| example_plot_hierarchical_calibration_fission_gas | 13.71 |
| example_plot_ifs | 13.43 |
| example_plot_smolyak_quadrature | 13.41 |
| RandomWalkMetropolisHastings_std | 13.23 |
| DistributionFactory_std | 12.74 |
| GaussianLinearCalibration_noobs | 12.69 |
| example_plot_calibration_flooding | 12.48 |
| Ceres_std | 12.26 |
| example_plot_ratio_of_uniforms_exploitation | 12.24 |
| InverseWishart_std | 12.06 |
| PointToFieldFunctionalChaosAlgorithm_std | 12.01 |
| EfficientGlobalOptimization_std | 11.02 |
| ExtremeValueCopula_std | 10.87 |
| Distribution_python | 10.76 |
This listing might be interesting for developers who would like to reduce the elapsed time of some of these scripts. Sometimes, reducing the sample size or the polynomial degree, for example, can help.
Regards,
Michaël


