mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 23:38:57 +08:00
Fix elasticsearch status display (#3487)
### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: jinhai <haijin.chn@gmail.com>
This commit is contained in:
parent
568322aeaf
commit
883fafde72
@ -63,7 +63,9 @@ class ESConnection(DocStoreConnection):
|
||||
return "elasticsearch"
|
||||
|
||||
def health(self) -> dict:
|
||||
return dict(self.es.cluster.health()) + {"type": "elasticsearch"}
|
||||
health_dict = dict(self.es.cluster.health())
|
||||
health_dict["type"] = "elasticsearch"
|
||||
return health_dict
|
||||
|
||||
"""
|
||||
Table operations
|
||||
|
@ -55,7 +55,7 @@ class RAGFlowMinio(object):
|
||||
)
|
||||
return r
|
||||
except Exception:
|
||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
||||
logging.exception(f"Fail to put {bucket}/{fnm}:")
|
||||
self.__open__()
|
||||
time.sleep(1)
|
||||
|
||||
@ -63,37 +63,37 @@ class RAGFlowMinio(object):
|
||||
try:
|
||||
self.conn.remove_object(bucket, fnm)
|
||||
except Exception:
|
||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
||||
logging.exception(f"Fail to remove {bucket}/{fnm}:")
|
||||
|
||||
def get(self, bucket, fnm):
|
||||
def get(self, bucket, filename):
|
||||
for _ in range(1):
|
||||
try:
|
||||
r = self.conn.get_object(bucket, fnm)
|
||||
r = self.conn.get_object(bucket, filename)
|
||||
return r.read()
|
||||
except Exception:
|
||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
||||
logging.exception(f"Fail to get {bucket}/{filename}")
|
||||
self.__open__()
|
||||
time.sleep(1)
|
||||
return
|
||||
|
||||
def obj_exist(self, bucket, fnm):
|
||||
def obj_exist(self, bucket, filename):
|
||||
try:
|
||||
if not self.conn.bucket_exists(bucket):
|
||||
return False
|
||||
if self.conn.stat_object(bucket, fnm):
|
||||
if self.conn.stat_object(bucket, filename):
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
except Exception:
|
||||
logging.exception(f"RAGFlowMinio.obj_exist {bucket}/{fnm} got exception:")
|
||||
return False
|
||||
|
||||
logging.exception(f"Not found: {bucket}/{filename}")
|
||||
return False
|
||||
|
||||
def get_presigned_url(self, bucket, fnm, expires):
|
||||
for _ in range(10):
|
||||
try:
|
||||
return self.conn.get_presigned_url("GET", bucket, fnm, expires)
|
||||
except Exception:
|
||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
||||
logging.exception(f"Fail to get_presigned {bucket}/{fnm}:")
|
||||
self.__open__()
|
||||
time.sleep(1)
|
||||
return
|
||||
@ -101,11 +101,11 @@ class RAGFlowMinio(object):
|
||||
|
||||
MINIO = RAGFlowMinio()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
conn = RAGFlowMinio()
|
||||
fnm = "/opt/home/kevinhu/docgpt/upload/13/11-408.jpg"
|
||||
from PIL import Image
|
||||
|
||||
img = Image.open(fnm)
|
||||
buff = BytesIO()
|
||||
img.save(buff, format='JPEG')
|
||||
|
Loading…
x
Reference in New Issue
Block a user