Files
langgraph/docs/_scripts/execute_notebooks.sh
T
Isaac FranciscoandGitHub 662eae4359 adding tutorials to notebook checks (#1747)
* wip

* actually catch errors

* fixing tool-calling-errors and persistence-redis

* poetry changes

* poetry update

* run tutorials

* only tutorials (testing)

* print errors

* rewoo fixes

* remove customer support because of user input

* skip notebooks programatically

* add back how-tos

* remove redundant if

* add cassetes for tutorials

* remove no execution since it is generated by CI,

* remove multi-agent/usaco

* try to run in parallel

* skip notebooks fix

* remove magic/non-magic cells

* msgpack instead of yaml

* prepare_notebooks change

* ignore msgpack for spelling

* use compression for cassettes

* update spell check

* reset poetry changes

* upgrade packages for latest

* no update

* poetry changes
2024-09-20 12:11:23 -07:00

32 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Read the list of notebooks to skip from the JSON file
SKIP_NOTEBOOKS=$(python -c "import json; print('\n'.join(json.load(open('docs/notebooks_no_execution.json'))))")
# Function to execute a single notebook
execute_notebook() {
file="$1"
echo "Starting execution of $file"
start_time=$(date +%s)
if ! output=$(time poetry run jupyter execute --allow-errors "$file" 2>&1); then
end_time=$(date +%s)
execution_time=$((end_time - start_time))
echo "Error in $file. Execution time: $execution_time seconds"
echo "Error details: $output"
exit 1
fi
end_time=$(date +%s)
execution_time=$((end_time - start_time))
echo "Finished $file. Execution time: $execution_time seconds"
}
export -f execute_notebook
# Find all notebooks and filter out those in the skip list
notebooks=$(find docs/docs/tutorials docs/docs/how-tos -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS"))
# Run notebooks in parallel
if ! parallel execute_notebook ::: $notebooks; then
echo "Errors occurred during notebook execution"
exit 1
fi