model-service/model_service/utils/storage.py
marcsello 284dfce735
All checks were successful
continuous-integration/drone/push Build is passing
Added ability to store CNN models
2020-07-28 20:19:52 +02:00

19 lines
538 B
Python

from flask import current_app
from flask_minio import Minio
from minio.error import BucketAlreadyExists, BucketAlreadyOwnedByYou
storage = Minio()
def ensure_buckets():
for bucket_name in [current_app.config['MINIO_SVM_BUCKET_NAME'],
current_app.config['MINIO_CNN_BUCKET_NAME']]:
try:
storage.connection.make_bucket(bucket_name)
except BucketAlreadyOwnedByYou:
pass
except BucketAlreadyExists:
pass
# Everything else should be raised