Skip to content
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

Generate downloadable tgz on server for each model #17

Open
alx opened this issue Aug 24, 2020 · 0 comments
Open

Generate downloadable tgz on server for each model #17

alx opened this issue Aug 24, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@alx
Copy link
Collaborator

alx commented Aug 24, 2020

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
@alx alx added the enhancement New feature or request label Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant