Removed hard-coded urls
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Pünkösd Marcell 2021-07-27 17:44:14 +02:00
parent c757b838dd
commit 439a3faed6

View File

@ -4,12 +4,15 @@ import logging
import tempfile import tempfile
import requests import requests
import time import time
from urllib.parse import urljoin
from classifier_cache import ClassifierCache from classifier_cache import ClassifierCache
class MagicDoer: class MagicDoer:
classifier_cache = ClassifierCache() classifier_cache = ClassifierCache(
os.environ.get("MODEL_INFO_URL", "http://model-service/model/cnn/$default")
)
@classmethod @classmethod
def run_everything(cls, parameters: dict) -> dict: def run_everything(cls, parameters: dict) -> dict:
@ -19,9 +22,11 @@ class MagicDoer:
try: try:
# Download Sample # Download Sample
storage_service_url = os.environ.get("STORAGE_SERVICE_URL", "http://storage-service/")
object_path = urljoin(storage_service_url, f"object/{tag}")
logging.info(f"Downloading sample: {tag}") logging.info(f"Downloading sample: {tag} from {object_path}")
r = requests.get(f"http://storage-service/object/{tag}") r = requests.get(object_path)
with open(sample_file_handle, 'wb') as f: with open(sample_file_handle, 'wb') as f:
f.write(r.content) f.write(r.content)