fix pylint
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#!.venv/bin/python
|
||||
"""
|
||||
Orchestratore dei worker che inviano i dati ai clienti
|
||||
"""
|
||||
|
||||
# Import necessary libraries
|
||||
import logging
|
||||
@@ -11,8 +14,9 @@ from utils.csv.loaders import get_next_csv_atomic
|
||||
from utils.orchestrator_utils import run_orchestrator, worker_context
|
||||
from utils.connect.send_data import process_workflow_record
|
||||
from utils.general import alterna_valori
|
||||
#from utils.ftp.send_data import ftp_send_elab_csv_to_customer, api_send_elab_csv_to_customer, ftp_send_raw_csv_to_customer, api_send_raw_csv_to_customer
|
||||
|
||||
# from utils.ftp.send_data import ftp_send_elab_csv_to_customer, api_send_elab_csv_to_customer, \
|
||||
# ftp_send_raw_csv_to_customer, api_send_raw_csv_to_customer
|
||||
|
||||
|
||||
# Initialize the logger for this module
|
||||
@@ -23,6 +27,7 @@ ELAB_PROCESSING_DELAY = 0.2
|
||||
# Tempo di attesa se non ci sono record da elaborare
|
||||
NO_RECORD_SLEEP = 30
|
||||
|
||||
|
||||
async def worker(worker_id: int, cfg: object, pool: object) -> None:
|
||||
"""Esegue il ciclo di lavoro per l'invio dei dati.
|
||||
|
||||
@@ -42,7 +47,10 @@ async def worker(worker_id: int, cfg: object, pool: object) -> None:
|
||||
debug_mode = logging.getLogger().getEffectiveLevel() == logging.DEBUG
|
||||
logger.info("Avviato")
|
||||
|
||||
alternatore = alterna_valori([WorkflowFlags.CSV_RECEIVED,WorkflowFlags.SENT_RAW_DATA], [WorkflowFlags.DATA_ELABORATED, WorkflowFlags.SENT_ELAB_DATA])
|
||||
alternatore = alterna_valori(
|
||||
[WorkflowFlags.CSV_RECEIVED, WorkflowFlags.SENT_RAW_DATA],
|
||||
[WorkflowFlags.DATA_ELABORATED, WorkflowFlags.SENT_ELAB_DATA],
|
||||
)
|
||||
|
||||
while True:
|
||||
try:
|
||||
@@ -58,8 +66,8 @@ async def worker(worker_id: int, cfg: object, pool: object) -> None:
|
||||
logger.info("Nessun record disponibile")
|
||||
await asyncio.sleep(NO_RECORD_SLEEP)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Errore durante l'esecuzione: {e}", exc_info=debug_mode)
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
logger.error("Errore durante l'esecuzione: %s", e, exc_info=debug_mode)
|
||||
await asyncio.sleep(1)
|
||||
|
||||
|
||||
@@ -67,5 +75,6 @@ async def main():
|
||||
"""Funzione principale che avvia il send_orchestrator."""
|
||||
await run_orchestrator(setting.Config, worker)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user