microservices/deployment-service/snakeapi_service/entrypoint.sh

17 lines
520 B
Bash
Raw Normal View History

2025-04-25 09:21:18 -07:00
#!/usr/bin/env bash
2025-04-29 13:28:25 -07:00
NOTEBOOK_DIR="notebooks"
2025-04-29 15:01:23 -07:00
mkdir -p "${NOTEBOOK_DIR}"
2025-04-29 11:40:06 -07:00
2025-04-29 15:01:23 -07:00
# fetch latest notebook
aws --endpoint-url "$AWS_ENDPOINT_URL_S3" --region "$AWS_REGION" \
s3 sync "s3://$BUCKET_NAME/$INSTANCE_PREFIX/notebooks/" "${NOTEBOOK_DIR}/"
2025-04-25 09:21:18 -07:00
2025-04-29 15:01:23 -07:00
# convert to Python script for dynamic import
latest_ipynb=$(ls -t "${NOTEBOOK_DIR}"/*.ipynb | head -1)
if [ -n "$latest_ipynb" ]; then
jupyter nbconvert --to script "$latest_ipynb" --output "${NOTEBOOK_DIR}/notebook.py"
fi
2025-04-25 09:21:18 -07:00
2025-04-29 15:01:23 -07:00
# start the Flask server
python snakeapi_server.py