add multi file logs filter errors
This commit is contained in:
@@ -12,6 +12,7 @@ from utils.csv.loaders import get_next_csv_atomic
|
||||
from utils.orchestrator_utils import run_orchestrator, worker_context
|
||||
from utils.database.loader_action import update_status, unlock
|
||||
from utils.connect.send_email import send_error_email
|
||||
from utils.general import read_error_lines_from_logs
|
||||
|
||||
# Initialize the logger for this module
|
||||
logger = logging.getLogger()
|
||||
@@ -64,20 +65,24 @@ async def worker(worker_id: int, cfg: object, pool: object) -> None:
|
||||
if proc.returncode != 0:
|
||||
logger.error("Errore durante l'elaborazione")
|
||||
logger.error(stderr.decode().strip())
|
||||
with open(f"{cfg.matlab_error_path}{unit_name}{tool_name}_output_error.txt", "w") as f:
|
||||
f.write(stderr.decode().strip())
|
||||
|
||||
if proc.returncode == 124:
|
||||
error_type = f"Matlab elab excessive duration: killed after {cfg.matlab_timeout} seconds."
|
||||
else:
|
||||
error_type = f"Matlab elab failed: {proc.returncode}."
|
||||
|
||||
"""
|
||||
da verificare i log degli errori come sono creati... dal perl:
|
||||
"cd $MatlabErrorPath; cat _${unit}_${tool}*_\*_output_error.txt > ${unit}${tool}_output_error.txt";
|
||||
|
||||
da verificare i log dove prenderli
|
||||
|
||||
with open(f"{cfg.matlab_error_path}{unit_name}{tool_name}_output_error.txt", "w") as f:
|
||||
f.write(stderr.decode().strip())
|
||||
# errors = [line for line in stderr.decode().strip() if line.startswith("Error")]
|
||||
# warnings = [line for line in stderr.decode().strip() if not line.startswith("Error")]
|
||||
"""
|
||||
errors = [line for line in stderr.decode().strip() if line.startswith("Error")]
|
||||
warnings = [line for line in stderr.decode().strip() if line.startswith("Warning")]
|
||||
await send_error_email(unit_name.upper(), tool_name.upper(), tool_elab_info['matcall'], error_type, errors, warnings) # da verificare
|
||||
|
||||
errors, warnings = await read_error_lines_from_logs(cfg.matlab_error_path, f"_{unit_name}_{tool_name}*_*_output_error.txt")
|
||||
await send_error_email(unit_name.upper(), tool_name.upper(), tool_elab_info['matcall'], error_type, errors, warnings)
|
||||
|
||||
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user