From 6ece3be28c738d1835a8f333b4abe7f33894ed67 Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Fri, 4 Oct 2024 08:54:28 +0200 Subject: [PATCH] Revert "optimize loki" --- pilot/control/payload.py | 2 +- pilot/util/https.py | 3 +-- pilot/util/lokirealtimelogger.py | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pilot/control/payload.py b/pilot/control/payload.py index 77b20aa7..7d091073 100644 --- a/pilot/control/payload.py +++ b/pilot/control/payload.py @@ -444,7 +444,7 @@ def get_logging_info(job: JobData, args: object) -> dict: logger.info("correct logserver formal: logging_type;protocol://hostname:port") return {} - regex = r"logserver=(?P[^;]+);(?P[^:]+)://(?P[^:]+):(?P\d+)" + regex = r"logserver='(?P[^;]+);(?P[^:]+)://(?P[^:]+):(?P\d+)'" match = search(regex, logserver) if match: logging_type = match.group('logging_type') diff --git a/pilot/util/https.py b/pilot/util/https.py index 71efa45f..a26c75ce 100644 --- a/pilot/util/https.py +++ b/pilot/util/https.py @@ -858,8 +858,7 @@ def request2(url: str = "", # Send the request securely try: logger.debug('sending data to server') - timeout = int(config.Pilot.http_maxtime) - with urllib.request.urlopen(req, context=ssl_context, timeout=timeout) as response: + with urllib.request.urlopen(req, context=ssl_context, timeout=30) as response: # Handle the response here logger.debug(f"response.status={response.status}, response.reason={response.reason}") ret = response.read().decode('utf-8') diff --git a/pilot/util/lokirealtimelogger.py b/pilot/util/lokirealtimelogger.py index 72933352..50b3a5cc 100644 --- a/pilot/util/lokirealtimelogger.py +++ b/pilot/util/lokirealtimelogger.py @@ -51,22 +51,18 @@ def format(self, record: logging.LogRecord) -> dict: formatted = { "timestamp": record.created, - # "process": record.process, - # "thread": record.thread, + "process": record.process, + "thread": record.thread, "function": record.funcName, "module": record.module, "name": record.name, "level": record.levelname, } - """ - # Not send all information, some loki services have limitations on number of labels. - record_keys = set(record.__dict__.keys()) for key in record_keys: if key not in formatted and key not in ['msg']: formatted[key] = getattr(record, key) - """ message = record.msg try: