Commit e8d23f5f authored by Grzegorz Kostkowski's avatar Grzegorz Kostkowski

Change entrypoint to always download model

parent c4e1c8c5
Pipeline #4135 passed with stage
in 11 minutes and 36 seconds
#!/bin/sh
# Script downloads models defined in config file and starts worker.
# Script downloads models defined in config file and starts worker.
# Script should be called inside a container.
config_file='/home/worker/config.ini'
# for now, name of file won't be changed so it's ok to use hardcoded value
model_filename='merged_graph.xml.gz'
model_filename='merged_graph.xml.gz'
# Simple function to retireve value for given key from ini file.
# Note that key should be unique, it does not handle sections
......@@ -33,12 +33,15 @@ cd "$model_dir"
model_dir=$(get_ini_value "$config_file" "model_dir")
model_url=$(get_ini_value "$config_file" "model_url")
if [ ! -f "$model_filename" ]; then
echo "Downloading a model '$model_filename' from '$model_url' ..."
remote_model_name="$model_filename"'.zip' # assuming it is a zip archive
wget -O "$remote_model_name" "$model_url"
unzip "$remote_model_name"; rm "$remote_model_name"
echo "Done!"
if [ -f "$model_filename" ]; then
echo "Removing old model ..."
rm -f "$model_filename"
fi
echo "Downloading a model '$model_filename' from '$model_url' ..."
remote_model_name="$model_filename"'.zip' # assuming it is a zip archive
wget -O "$remote_model_name" "$model_url"
unzip "$remote_model_name"; rm "$remote_model_name"
echo "Done!"
cd /home/worker && python3.6 main.py
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment