增加数据文件保存配置选项
This commit is contained in:
+8
-6
@@ -491,12 +491,6 @@ class ComputeService:
|
|||||||
if not out_path or not result:
|
if not out_path or not result:
|
||||||
return json.dumps({'error': 'Compute failed'})
|
return json.dumps({'error': 'Compute failed'})
|
||||||
|
|
||||||
# 删除输出文件
|
|
||||||
try:
|
|
||||||
os.remove(out_path)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# 转换为JSON
|
# 转换为JSON
|
||||||
result_json = json.dumps(result, cls=CustomFloatEncoder)
|
result_json = json.dumps(result, cls=CustomFloatEncoder)
|
||||||
|
|
||||||
@@ -512,6 +506,14 @@ class ComputeService:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to compute file: {e}")
|
logger.error(f"Failed to compute file: {e}")
|
||||||
return json.dumps({'error': str(e)})
|
return json.dumps({'error': str(e)})
|
||||||
|
finally:
|
||||||
|
if not config_manager.get('data_file_save', True):
|
||||||
|
if csv_path and os.path.exists(csv_path):
|
||||||
|
os.remove(csv_path)
|
||||||
|
if mat_path and os.path.exists(mat_path):
|
||||||
|
os.remove(mat_path)
|
||||||
|
if out_path and os.path.exists(out_path):
|
||||||
|
os.remove(out_path)
|
||||||
|
|
||||||
def get_status(self) -> Dict[str, Any]:
|
def get_status(self) -> Dict[str, Any]:
|
||||||
"""获取服务状态
|
"""获取服务状态
|
||||||
|
|||||||
Reference in New Issue
Block a user