Skip to content

Commit

Permalink
print progress in execution script
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Oct 23, 2024
1 parent f9c7281 commit d6a086e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions docs/scripts/execute_notebooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ WORKING_DIRECTORY=$1
# Function to execute a single notebook
execute_notebook() {
file="$1"
echo "Starting execution of $file"
index="$2"
total="$3"
echo "Starting execution of $file ($index/$total)"
start_time=$(date +%s)
if ! output=$(time poetry run jupyter nbconvert --to notebook --execute --ExecutePreprocessor.kernel_name=python3 $file 2>&1); then
end_time=$(date +%s)
Expand All @@ -32,7 +34,13 @@ else
notebooks=$(find "$WORKING_DIRECTORY" -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS"))
fi

# Execute notebooks sequentially
for file in $notebooks; do
execute_notebook "$file"
# Convert the list of notebooks to an array
notebooks_array=($notebooks)
total_notebooks=${#notebooks_array[@]}

# Execute notebooks sequentially with progress indication
for i in "${!notebooks_array[@]}"; do
file="${notebooks_array[$i]}"
index=$((i + 1))
execute_notebook "$file" "$index" "$total_notebooks"
done

0 comments on commit d6a086e

Please sign in to comment.