bugfix: adds bucket name configuration into the .env file

This commit is contained in:
Tomasz Dłuski
2020-09-05 13:58:45 +02:00
parent bddbec77f1
commit eebc9d0c46
2 changed files with 10 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ from minio.error import ResponseError
accessID = os.environ.get('AWS_ACCESS_KEY_ID') accessID = os.environ.get('AWS_ACCESS_KEY_ID')
accessSecret = os.environ.get('AWS_SECRET_ACCESS_KEY') accessSecret = os.environ.get('AWS_SECRET_ACCESS_KEY')
minioUrl = os.environ.get('MLFLOW_S3_ENDPOINT_URL') minioUrl = os.environ.get('MLFLOW_S3_ENDPOINT_URL')
bucketName = os.environ.get('AWS_BUCKET_NAME')
if accessID == None: if accessID == None:
print('[!] AWS_ACCESS_KEY_ID environemnt variable is empty! run \'source .env\' to load it from the .env file') print('[!] AWS_ACCESS_KEY_ID environemnt variable is empty! run \'source .env\' to load it from the .env file')
@@ -19,6 +20,11 @@ if minioUrl == None:
print('[!] MLFLOW_S3_ENDPOINT_URL environemnt variable is empty! run \'source .env\' to load it from the .env file') print('[!] MLFLOW_S3_ENDPOINT_URL environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1) exit(1)
if bucketName == None:
print('[!] AWS_BUCKET_NAME environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1)
minioUrlHostWithPort = minioUrl.split('//')[1] minioUrlHostWithPort = minioUrl.split('//')[1]
print('[*] minio url: ',minioUrlHostWithPort) print('[*] minio url: ',minioUrlHostWithPort)
@@ -29,4 +35,4 @@ s3Client = Minio(
secure=False secure=False
) )
s3Client.make_bucket('mlflow') s3Client.make_bucket(bucketName)

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
source .env
set -o allexport; source .env; set +o allexport
pip install Minio pip install Minio
python ./create_bucket.py python ./create_bucket.py