modified index.js

This commit is contained in:
yoshi 2025-04-29 13:28:25 -07:00
parent 0260a24da1
commit 61650658eb
4 changed files with 106 additions and 65 deletions

View file

@ -1,21 +1,17 @@
#!/usr/bin/env bash
last_mod=0
NOTEBOOK_DIR="notebooks"
mkdir -p ${NOTEBOOK_DIR}
while true; do
aws --endpoint-url "$AWS_ENDPOINT_URL_S3" --region "$AWS_REGION" \
s3 sync "s3://$BUCKET_NAME/$INSTANCE_PREFIX" . --exclude "*" --include "notebook.ipynb"
s3 sync "s3://$BUCKET_NAME/$INSTANCE_PREFIX/notebooks/" "${NOTEBOOK_DIR}/"
if [ -f "notebook.ipynb" ]; then
new_mod=$(stat -c %Y notebook.ipynb)
else
new_mod=0
latest_notebook=$(ls -t ${NOTEBOOK_DIR}/*.ipynb | head -1)
if [ -n "$latest_notebook" ]; then
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=0 "$latest_notebook"
fi
if [ "$new_mod" -ne "$last_mod" ]; then
last_mod=$new_mod
jupyter nbconvert --to notebook --execute --inplace --ExecutePreprocessor.timeout=0 notebook.ipynb
fi
sleep 1
sleep 5
done