When a new model is created after a training job, it should also generate a tgz archive that user could access/download.
Here is a solution using a new Docker container to periodically scan model folders, and create a tgz archive in these folders if it's missing.
FROM alpine:3.7
COPY createDownloadableService /etc/periodic/hourly/createDownloadableService
RUN chmod +x /etc/periodic/hourly/createDownloadableService
CMD crond -l 2 -f
createDownloadableService script:
#!/bin/sh
SERVICE_PATH=/opt/platform/models/public
for f in $SERVICE_PATH/*; do
if [[ -d "$f" ]]; then
# $f is a directory
MODEL_NAME="$(basename $f)"
MODEL_ARCHIVE="$f/$MODEL_NAME.tar.gz"
if [[ ! -f "$MODEL_ARCHIVE" ]]; then
# if $f/$MODEL_NAME.tar.gz doesn't exist
# create it with content from $f
tar -zcf $MODEL_ARCHIVE -C $f .
fi
fi
done
When a new model is created after a training job, it should also generate a tgz archive that user could access/download.
Here is a solution using a new Docker container to periodically scan model folders, and create a tgz archive in these folders if it's missing.
BusyBox cron container example: https://gist.github.com/andyshinn/3ae01fa13cb64c9d36e7
Dockerfile:createDownloadableServicescript: