diff --git a/use_case_examples/time_notebook_execution.sh b/use_case_examples/time_notebook_execution.sh index a800fbe56..3b01f10e5 100755 --- a/use_case_examples/time_notebook_execution.sh +++ b/use_case_examples/time_notebook_execution.sh @@ -4,10 +4,22 @@ print_time_execution() { printf " - Notebook %s executed in %02dh:%02dm:%02ds\n" "$1" $(($2/3600)) $(($2%3600/60)) $(($2%60)) } + START=$(date +%s) + +set +e jupyter nbconvert --to notebook --inplace --execute "$1" 1>&2 +result=$? +set -e + END=$(date +%s) TIME_EXEC=$((END-START)) -print_time_execution "$1" ${TIME_EXEC} +# Check the result of nbconvert execution +if [ $result -ne 0 ]; then + echo "Error: nbconvert failed with status $result" + exit $result +else + print_time_execution "$1" ${TIME_EXEC} +fi