-
Notifications
You must be signed in to change notification settings - Fork 65
Fixup notebook tests #933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fixup notebook tests #933
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e955be6
Fixup notebook tests
eric-anderson 25f02c2
try2
eric-anderson 3d50642
Merge branch 'main' into eric-localmode
eric-anderson 2dd3b36
add some logging
eric-anderson 18c6ab0
lock in the new 0.1.24 sycamore release
eric-anderson 733ce52
ignore notebooks/tmp
eric-anderson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ notebooks/default-prep-data | |
.python-version | ||
apps/timetrace/ttviz | ||
notebooks/pc-tutorial | ||
notebooks/tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/bash | ||
main() { | ||
config | ||
cd notebooks | ||
if [[ "$1" == --fast ]]; then | ||
echo "Testing fast notebooks..." | ||
local start=$(date +%s) | ||
test_notebooks "${FAST_NOTEBOOKS[@]}" | ||
local end=$(date +%s) | ||
local elapsed=$(expr $end - $start) | ||
echo "-------------------------------------------------------" | ||
echo "--- Testing fast notebooks took $elapsed/$FAST_MAXTIME seconds" | ||
if [[ $elapsed -ge $FAST_MAXTIME ]]; then | ||
echo "--- Fast tests took too long." | ||
echo "--- Move some fast tests to slow," | ||
echo "--- or speed up the fast notebooks." | ||
exit 1 | ||
fi | ||
echo "-------------------------------------------------------" | ||
check_coverage | ||
elif [[ "$1" == --slow ]]; then | ||
echo "Testing slow notebooks..." | ||
test_notebooks "${SLOW_NOTEBOOKS[@]}" | ||
else | ||
echo "Usage: $0 {--fast,--slow}" | ||
exit 1 | ||
fi | ||
exit 0 | ||
} | ||
|
||
config() { | ||
FAST_NOTEBOOKS=( | ||
default-prep-script.ipynb # 20+40s on Eric's laptop. | ||
OpenAI-logprob.ipynb # 5s on Eric's laptop. | ||
) | ||
|
||
FAST_MAXTIME=120 | ||
SLOW_NOTEBOOKS=( | ||
ArynPartitionerExample.ipynb # Gets a crash message, but passes? | ||
ArynPartitionerPython.ipynb | ||
jupyter_dev_example.ipynb # O(n^2) from re-show/take | ||
metadata-extraction.ipynb # processes entire | ||
sycamore_demo.ipynb # O(n^2) from re-show/take | ||
tutorial.ipynb # aryn partitioner on entire sort benchmark | ||
VisualizePartitioner.ipynb | ||
) | ||
EXCLUDE_NOTEBOOKS=( | ||
# No good reason for exclusion, just what was | ||
# not automatically tested before | ||
ArynPartitionerWithLangchain.ipynb # needs langchain to be installed | ||
duckdb-writer.ipynb # timeout | ||
elasticsearch-writer.ipynb # needs elasticsearch db setup | ||
financial-docs-10k-example.ipynb # needs to be fixed like | ||
# tutorial to have assertion, assertion code needs to move to aryn_sdk | ||
ndd_example.ipynb #broken | ||
ntsb-demo.ipynb # needs rps | ||
opensearch_docs_etl.ipynb # timeout | ||
opensearch-writer.ipynb # depends on langchain | ||
pinecone-writer.ipynb # needs pinccone key | ||
query-demo.ipynb # depnds on un-checked in visualize.py | ||
subtask-sample.ipynb # broken -- old style llm prompts | ||
sycamore-tutorial-intermediate-etl.ipynb # timeout | ||
unpickle_query.ipynb # looking for uncommitted file | ||
weaviate-writer.ipynb # path not set to files | ||
) | ||
} | ||
|
||
test_notebooks() { | ||
for i in "$@"; do | ||
echo | ||
echo | ||
echo "-------------------------------------------------------------------------" | ||
echo "Starting test on $i as written" | ||
echo "-------------------------------------------------------------------------" | ||
|
||
time poetry run pytest --nbmake --nbmake-timeout=600 $i || exit 1 | ||
|
||
if [[ $(grep -c sycamore.EXEC_LOCAL $i) -ge 1 ]]; then | ||
sed -e 's/sycamore.EXEC_LOCAL/sycamore.EXEC_RAY/' <$i >ray-variant-$i | ||
echo "-------------------------------------------------------------------------" | ||
echo "Starting test on $i with EXEC_RAY" | ||
echo "-------------------------------------------------------------------------" | ||
time poetry run pytest --nbmake --nbmake-timeout=600 ray-variant-$i || exit 1 | ||
rm ray-variant-$i | ||
fi | ||
done | ||
} | ||
|
||
check_coverage() { | ||
echo "Verifying coverage of all notebooks..." | ||
ls *.ipynb | grep -v '^ray-variant-' >/tmp/notebooks.list | ||
( | ||
for i in "${FAST_NOTEBOOKS[@]}" "${SLOW_NOTEBOOKS[@]}" "${EXCLUDE_NOTEBOOKS[@]}"; do | ||
echo "$i" | ||
done | ||
) >>/tmp/notebooks.list | ||
sort /tmp/notebooks.list | uniq -c | sort -n | grep -v '^ 2 ' >/tmp/notebooks.unlisted | ||
if [[ $(wc -l </tmp/notebooks.unlisted) != 0 ]]; then | ||
echo "ERROR: some notebooks are unlisted." | ||
echo " Add them to FAST_NOTEBOOKS for fast tests that block commits," | ||
echo " SLOW_NOTEBOOKS for slower tests that do not block commits," | ||
echo " or EXCLUDE_NOTEBOOKS for notebooks that should not be automatically tested." | ||
echo " Missing noteboos:" | ||
sed 's/^ 1 //' /tmp/notebooks.unlisted | ||
exit 1 | ||
fi | ||
rm /tmp/notebooks.list /tmp/notebooks.unlisted | ||
echo "All notebooks are classified as fast, slow or excluded." | ||
} | ||
|
||
main "$@" | ||
exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems related/overlapping with #925. Are they going to conflict?