lint con ruff
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import logging
|
||||
import asyncio
|
||||
import os
|
||||
import aiomysql
|
||||
import contextvars
|
||||
from typing import Callable, Coroutine, Any
|
||||
import logging
|
||||
import os
|
||||
from collections.abc import Callable, Coroutine
|
||||
from typing import Any
|
||||
|
||||
import aiomysql
|
||||
|
||||
# Crea una context variable per identificare il worker
|
||||
worker_context = contextvars.ContextVar("worker_id", default="^-^")
|
||||
@@ -35,9 +37,7 @@ def setup_logging(log_filename: str, log_level_str: str):
|
||||
"""
|
||||
logger = logging.getLogger()
|
||||
handler = logging.FileHandler(log_filename)
|
||||
formatter = WorkerFormatter(
|
||||
"%(asctime)s - PID: %(process)d.Worker-%(worker_id)s.%(name)s.%(funcName)s.%(levelname)s: %(message)s"
|
||||
)
|
||||
formatter = WorkerFormatter("%(asctime)s - PID: %(process)d.Worker-%(worker_id)s.%(name)s.%(funcName)s.%(levelname)s: %(message)s")
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
# Rimuovi eventuali handler esistenti e aggiungi il nostro
|
||||
@@ -83,11 +83,7 @@ async def run_orchestrator(
|
||||
pool_recycle=3600,
|
||||
)
|
||||
|
||||
tasks = [
|
||||
asyncio.create_task(worker_coro(i, cfg, pool))
|
||||
for i in range(cfg.max_threads)
|
||||
]
|
||||
|
||||
tasks = [asyncio.create_task(worker_coro(i, cfg, pool)) for i in range(cfg.max_threads)]
|
||||
|
||||
logger.info("Sistema avviato correttamente. In attesa di nuovi task...")
|
||||
|
||||
@@ -101,4 +97,4 @@ async def run_orchestrator(
|
||||
logger.info("Info: Shutdown richiesto... chiusura in corso")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Errore principale: {e}", exc_info=debug_mode)
|
||||
logger.error(f"Errore principale: {e}", exc_info=debug_mode)
|
||||
|
||||
Reference in New Issue
Block a user