diff --git a/moodlemlbackend/VERSION b/moodlemlbackend/VERSION index ccbccc3..c043eea 100644 --- a/moodlemlbackend/VERSION +++ b/moodlemlbackend/VERSION @@ -1 +1 @@ -2.2.0 +2.2.1 diff --git a/moodlemlbackend/webapp/s3.py b/moodlemlbackend/webapp/s3.py index 98f748f..55e8657 100644 --- a/moodlemlbackend/webapp/s3.py +++ b/moodlemlbackend/webapp/s3.py @@ -71,15 +71,16 @@ def get_model_dir(self, hashkey, fetch_model=False): def delete_dir(self): - s3 = boto3.client('s3') + s3 = boto3.resource('s3') bucketname = os.environ["MOODLE_MLBACKEND_PYTHON_S3_BUCKET_NAME"] + bucket = s3.Bucket(bucketname) # Objectkey will equal uniquemodelid so we delete all files matching # uniquemodelid/ namespace. objectkey = self.object_key(False) - for key in s3.listobjects(Bucket=bucketname, Prefix=objectkey + '/'): - key.delete() + + bucket.objects.filter(Prefix=objectkey + '/').delete() def object_key(self, hashkey=False): diff --git a/webapp.py b/webapp.py index e9c97e9..f6661b1 100644 --- a/webapp.py +++ b/webapp.py @@ -160,7 +160,7 @@ def import_model(): @setup_base_dir(storage, False, False) def deletemodel(): # All processing is delegated to delete_dir as it is file system dependant. - storage.delete_dir + storage.delete_dir() return 'Ok', 200