Skip to content

Commit 2bf8b65

Browse files
committed
update run_tests_testingfarm.py logging for ATEX 0.15
Signed-off-by: Jiri Jaburek <comps@nomail.dom>
1 parent 4b2214f commit 2bf8b65

File tree

2 files changed

+44
-24
lines changed

2 files changed

+44
-24
lines changed

.github/workflows/atex-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
# Restore permissions from the saved file created during build
100100
CONTENT_DIR="content-centos-stream${{ matrix.centos_stream_major }}"
101101
PERMS_FILE="${CONTENT_DIR}/file-permissions.txt"
102-
102+
103103
if [ -f "${PERMS_FILE}" ]; then
104104
echo "=== Restoring file permissions from ${PERMS_FILE} ==="
105105
cd "${CONTENT_DIR}"
@@ -143,7 +143,7 @@ jobs:
143143
- name: Install test dependencies
144144
run: |
145145
dnf -y install python3-pip rsync
146-
pip install fmf atex==0.13
146+
pip install fmf atex==0.15
147147
148148
- name: Run tests on Testing Farm
149149
env:
@@ -171,7 +171,7 @@ jobs:
171171
path: |
172172
results-centos-stream-${{ matrix.centos_stream_major }}-x86_64.json.xz
173173
files-centos-stream-${{ matrix.centos_stream_major }}-x86_64/
174-
atex_debug.log.gz
174+
atex_debug.log.xz
175175
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
176176

177177
upload:
@@ -190,7 +190,7 @@ jobs:
190190
if: always()
191191
run: |
192192
dnf -y install python3-pip git rsync
193-
pip install fmf atex==0.13
193+
pip install fmf atex==0.15
194194
195195
- name: Checkout ATEX results repository
196196
if: always()

tests/run_tests_testingfarm.py

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import sys
44
import time
5-
import gzip
65
import json
76
import lzma
87
import atexit
@@ -17,8 +16,6 @@
1716
from atex.aggregator.json import LZMAJSONAggregator
1817
from atex.fmf import FMFTests
1918

20-
logger = logging.getLogger("ATEX")
21-
2219

2320
def kv_pair(keyval):
2421
if "=" not in keyval:
@@ -42,21 +39,43 @@ def parse_args():
4239
return parser.parse_args()
4340

4441

42+
class OrchestratorLogFilter(logging.Filter):
43+
"""
44+
Filter (show) only messages from the atex.orchestrator logger,
45+
show all warnings (and above) from everywhere,
46+
show all from the root logger (logging.*).
47+
"""
48+
def filter(self, record):
49+
return (
50+
record.levelno >= logging.WARNING
51+
or record.name.startswith("atex.orchestrator")
52+
or record.name == "root"
53+
)
54+
55+
4556
def setup_logging():
4657
"""Setup logging configuration with console and file handlers."""
47-
# Log brief info to console, but be verbose in a separate file-based log (uploaded as artifact)
58+
# console - keep it brief, just basic orchestration + warnings
4859
console_log = logging.StreamHandler(sys.stderr)
4960
console_log.setLevel(logging.INFO)
61+
console_log.addFilter(OrchestratorLogFilter())
62+
console_log.setFormatter(logging.Formatter(
63+
fmt="%(asctime)s: %(message)s",
64+
datefmt="%Y-%m-%d %H:%M:%S",
65+
))
5066

51-
debug_log_fobj = gzip.open("atex_debug.log.gz", "wt")
67+
# debug log - store ALL debugging info, compressed
68+
debug_log_fobj = lzma.open("atex_debug.log.xz", "wt")
5269
atexit.register(debug_log_fobj.close)
5370
file_log = logging.StreamHandler(debug_log_fobj)
5471
file_log.setLevel(logging.DEBUG)
72+
file_log.setFormatter(logging.Formatter(
73+
fmt="%(asctime)s %(name)s: %(message)s",
74+
datefmt="%Y-%m-%d %H:%M:%S",
75+
))
5576

5677
logging.basicConfig(
5778
level=logging.DEBUG,
58-
format="%(asctime)s %(name)s: %(message)s",
59-
datefmt="%Y-%m-%d %H:%M:%S",
6079
handlers=(console_log, file_log),
6180
force=True,
6281
)
@@ -65,7 +84,7 @@ def setup_logging():
6584
def setup_signal_handlers():
6685
"""Setup signal handlers for graceful abort."""
6786
def abort_on_signal(signum, _):
68-
logger.error(f"got signal {signum}, aborting")
87+
logging.error(f"got signal {signum}, aborting")
6988
raise SystemExit(1)
7089

7190
signal.signal(signal.SIGTERM, abort_on_signal)
@@ -97,13 +116,13 @@ def main():
97116
},
98117
)
99118

100-
logger.info(f"plan: {args.plan}")
101-
logger.info(f"os major version: {args.os_major_version}")
102-
logger.info(f"arch: {args.arch}")
103-
logger.info(f"compose: {args.compose}")
104-
logger.info("will run:")
119+
logging.info(f"plan: {args.plan}")
120+
logging.info(f"os major version: {args.os_major_version}")
121+
logging.info(f"arch: {args.arch}")
122+
logging.info(f"compose: {args.compose}")
123+
logging.info("will run:")
105124
for test in fmf_tests.tests:
106-
logger.info(f" {test}")
125+
logging.info(f" {test}")
107126

108127
# Setup result aggregator
109128
output_results = f"results-centos-stream-{args.os_major_version}-{args.arch}.json.xz"
@@ -140,30 +159,31 @@ def main():
140159
)
141160
stack.enter_context(orchestrator)
142161

143-
logger.info("Starting test execution...")
162+
logging.info("Starting test execution...")
144163
next_writeout = time.monotonic() + 600
145164
while orchestrator.serve_once():
146165
if time.monotonic() > next_writeout:
147-
logger.info(
166+
logging.info(
167+
"STATISTICS: "
148168
f"queued: {len(orchestrator.to_run)}/{len(fmf_tests.tests)} tests, "
149169
f"running: {len(orchestrator.running_tests)} tests",
150170
)
151171
next_writeout = time.monotonic() + 600
152172
time.sleep(1)
153173

154-
logger.info("Test execution completed!")
174+
logging.info("Test execution completed!")
155175

156176
# Log final output locations
157-
logger.info(f"Results written to: {output_results}")
158-
logger.info(f"Test files in: {output_files}")
177+
logging.info(f"Results written to: {output_results}")
178+
logging.info(f"Test files in: {output_files}")
159179

160180
# Read back the compressed JSON results and exit with non-0 if anything failed
161181
with lzma.open(output_results, "rt") as results:
162182
for line in results:
163183
fields = json.loads(line)
164184
# [platform, status, test name, subtest name, files, note]
165185
if fields[1] in ("fail", "error", "infra"):
166-
logger.warning("failures found in the results, exiting with 1")
186+
logging.error("failures found in the results, exiting with 1")
167187
sys.exit(1)
168188

169189

0 commit comments

Comments
 (0)