Skip to content

Commit

Permalink
chore: no success on time_notebook failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrery committed Apr 15, 2024
1 parent d363066 commit 11bb870
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion use_case_examples/time_notebook_execution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 11bb870

Please sign in to comment.