dict cursor e pool conn

This commit is contained in:
2025-07-06 23:27:13 +02:00
parent 301aa53c72
commit 0022d0e326
6 changed files with 66 additions and 69 deletions

View File

@@ -48,22 +48,23 @@ async def worker(worker_id: int, cfg: object, pool) -> None:
if record:
id, unit_type, tool_type, unit_name, tool_name = [x.lower().replace(" ", "_") if isinstance(x, str) else x for x in record]
matlab_info = await get_matlab_command(cfg, tool_name, unit_name)
matlab_cmd = f"timeout {cfg.timeout} ./run_{matlab_info['matcall']}.sh {cfg.matlab_runtime} {unit_name} {tool_name}"
matlab_info = await get_matlab_command(cfg, tool_name, unit_name, pool)
if matlab_info:
matlab_cmd = f"timeout {cfg.matlab_timeout} ./run_{matlab_info['matcall']}.sh {cfg.matlab_runtime} {unit_name} {tool_name}"
# matlab_error_filename = f'{cfg.matlab_error_path}{unit_name}{tool_name}_output_error.txt'
# matlab_error_filename = f'{cfg.matlab_error_path}{unit_name}{tool_name}_output_error.txt'
success = await subprocess.run(matlab_cmd,
cwd=cfg.matlab_func_path,
capture_output=True,
text=True,
check=True)
success = await subprocess.run(matlab_cmd,
cwd=cfg.matlab_func_path,
capture_output=True,
text=True,
check=True)
if not success:
logger.error("Errore durante l'elaborazione")
await asyncio.sleep(ELAB_PROCESSING_DELAY)
if not success:
logger.error("Errore durante l'elaborazione")
await asyncio.sleep(ELAB_PROCESSING_DELAY)
else:
logger.debug("Nessun record disponibile")
logger.info("Nessun record disponibile")
await asyncio.sleep(NO_RECORD_SLEEP)
except Exception as e: