milvus/pyengine/engine/controller/group_handler.py
2019-03-22 20:55:36 +08:00

30 lines
867 B
Python

import os, shutil
from engine.settings import DATABASE_DIRECTORY
class GroupHandler(object):
@staticmethod
def CreateGroupDirectory(group_id):
path = GroupHandler.GetGroupDirectory(group_id)
path = path.strip()
path=path.rstrip("\\")
if not os.path.exists(path):
os.makedirs(path)
print("CreateGroupDirectory, Path: ", path)
@staticmethod
def DeleteGroupDirectory(group_id):
path = GroupHandler.GetGroupDirectory(group_id)
path = path.strip()
path=path.rstrip("\\")
if os.path.exists(path):
shutil.rmtree(path)
print("DeleteGroupDirectory, Path: ", path)
@staticmethod
def GetGroupDirectory(group_id):
print("GetGroupDirectory, Path: ", DATABASE_DIRECTORY + '/' + group_id)
return DATABASE_DIRECTORY + '/' + group_id