Skip to content

Commit

Permalink
parallelize notebook exec
Browse files Browse the repository at this point in the history
  • Loading branch information
zsimjee committed Nov 21, 2023
1 parent 156d7e1 commit 46f6d50
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/examples_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,16 @@ jobs:
- name: Execute notebooks and check for errors
run: |
cd docs/examples
for notebook in $(ls *.ipynb); do
poetry run jupyter nbconvert --to notebook --execute "$notebook"
if [ $? -ne 0 ]; then
echo "Error found in $notebook"
exit 1
fi
done
# Function to process a notebook
process_notebook() {
notebook="$1"
echo "Processing $notebook..."
jupyter nbconvert --to notebook --execute "$notebook"
if [ $? -ne 0 ]; then
echo "Error found in $notebook"
exit 1
fi
}
export -f process_notebook # Export the function for parallel execution
# Run in parallel
ls *.ipynb | parallel process_notebook

0 comments on commit 46f6d50

Please sign in to comment.