Skip to content

Generate downloadable tgz on server for each model #17

Description

@alx

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

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions