[TRTLLM-8580][test] save runtime report periodically (#8312) (#8455)

Signed-off-by: Ivy Zhang <25222398+crazydemo@users.noreply.github.com>
Signed-off-by: Mike Iovine <6158008+mikeiovine@users.noreply.github.com>
This commit is contained in:
Ivy Zhang 2025-10-20 10:54:24 +08:00 committed by Yanchao Lu
parent 2b58dba0f6
commit 23717cdb3f

View File

@ -2317,6 +2317,40 @@ def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
config.hook.pytest_deselected(items=deselected)
items[:] = selected
# Initialize PeriodicJUnitXML reporter if enabled
periodic = config.getoption("--periodic-junit", default=False)
output_dir = config.getoption("--output-dir", default=None)
if periodic and output_dir:
periodic_interval = config.getoption("--periodic-interval")
periodic_batch_size = config.getoption("--periodic-batch-size")
# Create the reporter with logger
xmlpath = os.path.join(output_dir, "results.xml")
reporter = PeriodicJUnitXML(
xmlpath=xmlpath,
interval=periodic_interval,
batch_size=periodic_batch_size,
logger={
'info': print_info,
'warning': print_warning
},
)
# Configure and register the reporter
reporter.pytest_configure(config)
config.pluginmanager.register(reporter, 'periodic_junit')
print_info("PeriodicJUnitXML reporter registered")
print_info(
f" Interval: {periodic_interval}s ({periodic_interval/60:.1f} min)"
)
print_info(f" Batch size: {periodic_batch_size} tests")
elif periodic and not output_dir:
print_warning(
"Warning: --periodic-junit requires --output-dir to be set. "
"Periodic reporting disabled.")
def deselect_by_test_model_suites(test_model_suites, items, test_prefix,
config):