From ab9e29bdaeadaf63f27798aa7716e3625b51ef32 Mon Sep 17 00:00:00 2001 From: douglas-raillard-arm Date: Wed, 5 Aug 2020 12:03:52 +0100 Subject: [PATCH] framework/output: Speedup discover_wa_outputs() Avoid recursing into subdirectory of folders containing __meta, since they are not of interest and recursing can take a very large amount of time if there are lot of files, like if there is a sysfs dump. --- wa/framework/output.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wa/framework/output.py b/wa/framework/output.py index 682d08a2..258669db 100644 --- a/wa/framework/output.py +++ b/wa/framework/output.py @@ -776,9 +776,13 @@ def init_job_output(run_output, job): def discover_wa_outputs(path): - for root, dirs, _ in os.walk(path): + # Use topdown=True to allow pruning dirs + for root, dirs, _ in os.walk(path, topdown=True): if '__meta' in dirs: yield RunOutput(root) + # Avoid recursing into the artifact as it can be very lengthy if a + # large number of file is present (sysfs dump) + dirs.clear() def _save_raw_config(meta_dir, state):