From: Zack Cerza Date: Fri, 1 Sep 2017 17:48:58 +0000 (-0600) Subject: prune: Use summary.yaml to determine age of job X-Git-Tag: 1.1.0~394^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a4dcf2b357ab8f9c5ecd12647e001ff750f96259;p=teuthology.git prune: Use summary.yaml to determine age of job If a job has been partially pruned, its directory's mtime will get bumped, causing total removal to be delayed by potentially months. Looking at the mtime of summary.yaml should provide results that are more intuitive. Signed-off-by: Zack Cerza --- diff --git a/teuthology/prune.py b/teuthology/prune.py index bbdcc4db6..cccd1d4c9 100644 --- a/teuthology/prune.py +++ b/teuthology/prune.py @@ -127,13 +127,13 @@ def maybe_remove_jobs(run_dir, pass_days, fail_days, dry_run=False): if PRESERVE_FILE in contents: return for child in contents: - item = os.path.join(run_dir, child) + job_path = os.path.join(run_dir, child) # Ensure the path isn't marked for preservation and that it is a # directory - if should_preserve(item) or not os.path.isdir(item): + if should_preserve(job_path) or not os.path.isdir(job_path): continue # Is it a job dir? - summary_path = os.path.join(item, 'summary.yaml') + summary_path = os.path.join(job_path, 'summary.yaml') if not os.path.exists(summary_path): continue # Depending on whether it passed or failed, we have a different age @@ -149,12 +149,12 @@ def maybe_remove_jobs(run_dir, pass_days, fail_days, dry_run=False): else: continue # Ensure the directory is old enough to remove - if not is_old_enough(item, days): + if not is_old_enough(summary_path, days): continue log.info("{job} is a {days}-day old {status} job; removing".format( - job=item, days=days, status=status)) + job=job_path, days=days, status=status)) if not dry_run: - remove(item) + remove(job_path) def maybe_remove_remotes(run_dir, days, dry_run=False):