creación de scheduler.json para ejecución de servicio
This commit is contained in:
1 parent
839aad698d
commit
1c39f6f45f
11 files changed
+112
-400
No files matched your search
+8
-6
@@ -3,6 +3,7 @@ import json
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# ============================================================================
|
||||
load_dotenv()
|
||||
|
||||
HANA_HOST = os.getenv("HANA_HOST", "")
|
||||
@@ -13,7 +14,7 @@ HANA_SCHEMA = os.getenv("HANA_SCHEMA", "")
|
||||
|
||||
_conn = None
|
||||
|
||||
|
||||
# ============================================================================
|
||||
def get_connection():
|
||||
global _conn
|
||||
if _conn is None:
|
||||
@@ -30,7 +31,7 @@ def get_connection():
|
||||
return None
|
||||
return _conn
|
||||
|
||||
|
||||
# ============================================================================
|
||||
def obtener_pendientes() -> list[dict]:
|
||||
|
||||
conn = get_connection()
|
||||
@@ -70,7 +71,7 @@ def obtener_pendientes() -> list[dict]:
|
||||
print(f" ❌ Error en query HANA: {e}")
|
||||
return []
|
||||
|
||||
|
||||
# ============================================================================
|
||||
def marcar_pdf_descargado(docentry: int, url: str, ruta: str):
|
||||
conn = get_connection()
|
||||
if not conn:
|
||||
@@ -89,7 +90,7 @@ def marcar_pdf_descargado(docentry: int, url: str, ruta: str):
|
||||
print(f" ❌ Error actualizando PDF HANA: {e}")
|
||||
return False
|
||||
|
||||
|
||||
# ============================================================================
|
||||
def marcar_xml_descargado(docentry: int, url: str, ruta: str):
|
||||
conn = get_connection()
|
||||
if not conn:
|
||||
@@ -108,7 +109,7 @@ def marcar_xml_descargado(docentry: int, url: str, ruta: str):
|
||||
print(f" ❌ Error actualizando XML HANA: {e}")
|
||||
return False
|
||||
|
||||
|
||||
# ============================================================================
|
||||
def cerrar_conexion():
|
||||
global _conn
|
||||
if _conn:
|
||||
@@ -118,7 +119,7 @@ def cerrar_conexion():
|
||||
pass
|
||||
_conn = None
|
||||
|
||||
|
||||
# ============================================================================
|
||||
if __name__ == "__main__":
|
||||
print("=" * 60)
|
||||
print("📋 HANA MANAGER - Prueba")
|
||||
@@ -132,3 +133,4 @@ if __name__ == "__main__":
|
||||
f"PDF={d['tienePDF']} XML={d['tieneXML']}")
|
||||
if len(docs) > 5:
|
||||
print(f" ... y {len(docs) - 5} más")
|
||||
# ============================================================================
|
||||
Reference in new issue
Block a user