mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 04:36:01 +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"
|
return "elasticsearch"
|
||||||
|
|
||||||
def health(self) -> dict:
|
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
|
Table operations
|
||||||
|
@ -55,7 +55,7 @@ class RAGFlowMinio(object):
|
|||||||
)
|
)
|
||||||
return r
|
return r
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
logging.exception(f"Fail to put {bucket}/{fnm}:")
|
||||||
self.__open__()
|
self.__open__()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
@ -63,37 +63,37 @@ class RAGFlowMinio(object):
|
|||||||
try:
|
try:
|
||||||
self.conn.remove_object(bucket, fnm)
|
self.conn.remove_object(bucket, fnm)
|
||||||
except Exception:
|
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):
|
for _ in range(1):
|
||||||
try:
|
try:
|
||||||
r = self.conn.get_object(bucket, fnm)
|
r = self.conn.get_object(bucket, filename)
|
||||||
return r.read()
|
return r.read()
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
logging.exception(f"Fail to get {bucket}/{filename}")
|
||||||
self.__open__()
|
self.__open__()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
def obj_exist(self, bucket, fnm):
|
def obj_exist(self, bucket, filename):
|
||||||
try:
|
try:
|
||||||
if not self.conn.bucket_exists(bucket):
|
if not self.conn.bucket_exists(bucket):
|
||||||
return False
|
return False
|
||||||
if self.conn.stat_object(bucket, fnm):
|
if self.conn.stat_object(bucket, filename):
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
return False
|
return False
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(f"RAGFlowMinio.obj_exist {bucket}/{fnm} got exception:")
|
logging.exception(f"Not found: {bucket}/{filename}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_presigned_url(self, bucket, fnm, expires):
|
def get_presigned_url(self, bucket, fnm, expires):
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
try:
|
try:
|
||||||
return self.conn.get_presigned_url("GET", bucket, fnm, expires)
|
return self.conn.get_presigned_url("GET", bucket, fnm, expires)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(f"Fail put {bucket}/{fnm}:")
|
logging.exception(f"Fail to get_presigned {bucket}/{fnm}:")
|
||||||
self.__open__()
|
self.__open__()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return
|
return
|
||||||
@ -101,11 +101,11 @@ class RAGFlowMinio(object):
|
|||||||
|
|
||||||
MINIO = RAGFlowMinio()
|
MINIO = RAGFlowMinio()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
conn = RAGFlowMinio()
|
conn = RAGFlowMinio()
|
||||||
fnm = "/opt/home/kevinhu/docgpt/upload/13/11-408.jpg"
|
fnm = "/opt/home/kevinhu/docgpt/upload/13/11-408.jpg"
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
img = Image.open(fnm)
|
img = Image.open(fnm)
|
||||||
buff = BytesIO()
|
buff = BytesIO()
|
||||||
img.save(buff, format='JPEG')
|
img.save(buff, format='JPEG')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user