modified snakeapi
This commit is contained in:
parent
55b2398370
commit
a3f0d83304
4 changed files with 49 additions and 20 deletions
|
|
@ -1,18 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
last_mod=0
|
||||
|
||||
while true; do
|
||||
# Fetch the latest notebook from S3 (common bucket + prefix)
|
||||
aws --endpoint-url "$AWS_ENDPOINT_URL_S3" --region "$AWS_REGION" \
|
||||
s3 cp "s3://$BUCKET_NAME/$INSTANCE_PREFIX/notebook.ipynb" notebook.ipynb
|
||||
s3 sync "s3://$BUCKET_NAME/$INSTANCE_PREFIX" . --exclude "*" --include "notebook.ipynb"
|
||||
|
||||
# Execute all cells, including run_server(...) in the last cell
|
||||
jupyter nbconvert \
|
||||
--to notebook \
|
||||
--execute \
|
||||
--inplace \
|
||||
--ExecutePreprocessor.timeout=0 \
|
||||
notebook.ipynb
|
||||
if [ -f "notebook.ipynb" ]; then
|
||||
new_mod=$(stat -c %Y notebook.ipynb)
|
||||
else
|
||||
new_mod=0
|
||||
fi
|
||||
|
||||
if [ "$new_mod" -ne "$last_mod" ]; then
|
||||
last_mod=$new_mod
|
||||
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=0 notebook.ipynb
|
||||
echo "Notebook executed; restarting..."
|
||||
fi
|
||||
|
||||
echo "Notebook executed; restarting..."
|
||||
sleep 1
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue