refs #2726 Waits 30 min for auxiliary files
parent
75efb96653
commit
32174016be
|
|
@ -34,6 +34,7 @@ from systemd import journal
|
||||||
# Imports para Swagger:
|
# Imports para Swagger:
|
||||||
from flasgger import Swagger
|
from flasgger import Swagger
|
||||||
import yaml
|
import yaml
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------------
|
||||||
|
|
@ -440,8 +441,22 @@ def check_aux_files(image_file_path, job_id):
|
||||||
"""
|
"""
|
||||||
journal.send("Running function 'check_aux_files'...", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
journal.send("Running function 'check_aux_files'...", PRIORITY=journal.LOG_INFO, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
|
|
||||||
# Creamos un bucle infinito:
|
# Creamos un bucle que espere durante media hora a que se creen los ficheros auxiliares
|
||||||
|
start_time = time.time()
|
||||||
|
timeout = 30 * 60 # 30 minutos
|
||||||
while True:
|
while True:
|
||||||
|
elapsed_time = time.time() - start_time
|
||||||
|
if elapsed_time > timeout:
|
||||||
|
journal.send("Timeout reached while waiting for auxiliary files", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
|
journal.send("{'component':'ogRepo', 'severity':'ERROR', 'operation':'Run function check_aux_files', 'desc':'Timeout reached while waiting for auxiliary files'}", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api")
|
||||||
|
data = {
|
||||||
|
'job_id': job_id,
|
||||||
|
'success': False,
|
||||||
|
'error': 'Timeout reached while waiting for auxiliary files'
|
||||||
|
}
|
||||||
|
journal.send(f"Calling function 'recall_ogcore' (JOB_ID: {job_id}, SUCCESS: False)", PRIORITY=journal.LOG_ERR, SYSLOG_IDENTIFIER="ogrepo-api_DEBUG")
|
||||||
|
recall_ogcore(data)
|
||||||
|
break
|
||||||
# Si faltan archivos auxiliares por crear, imprimimos un mensaje en la API:
|
# Si faltan archivos auxiliares por crear, imprimimos un mensaje en la API:
|
||||||
if not os.path.exists(f"{image_file_path}.size") or not os.path.exists(f"{image_file_path}.sum") or not os.path.exists(f"{image_file_path}.full.sum") or not os.path.exists(f"{image_file_path}.torrent") or not os.path.exists(f"{image_file_path}.info.checked"):
|
if not os.path.exists(f"{image_file_path}.size") or not os.path.exists(f"{image_file_path}.sum") or not os.path.exists(f"{image_file_path}.full.sum") or not os.path.exists(f"{image_file_path}.torrent") or not os.path.exists(f"{image_file_path}.info.checked"):
|
||||||
missing_files = []
|
missing_files = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue