#!/usr/bin/python3 from subprocess import run import configparser import sys parser = configparser.ConfigParser() parser.read("config.ini") s3_endpoint = parser["deployment"].get("s3_endpoint", "https://s3.clarin-pl.eu") s3_location = parser["deployment"].get( "models_s3_location", "s3://workers/winer/models" ) local_models_location = parser["deployment"].get("models_cache_dir", "/tmp/models") cmd = ( f'aws --no-sign-request --endpoint-url "{s3_endpoint}" s3 sync --delete' f' "{s3_location}" "{local_models_location}"' ) run(cmd, shell=True) run(["python", "worker.py"] + sys.argv[1:])