From 2e997aa7b1d4da97156edc76f571d250e83eafb9 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 31 Mar 2014 21:57:53 -0500 Subject: [PATCH] Report job updated time When reading job information from archive files, use the mtime of teuthology.log as the job updated time Signed-off-by: Zack Cerza --- teuthology/report.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/teuthology/report.py b/teuthology/report.py index 6fb84be92ed90..d684680f7e0ee 100644 --- a/teuthology/report.py +++ b/teuthology/report.py @@ -1,10 +1,12 @@ import os +from os.path import getmtime import yaml import json import re import requests import logging import socket +from datetime import datetime import teuthology from .config import config @@ -90,6 +92,12 @@ class ResultsSerializer(object): if partial_info is not None: job_info.update(partial_info) + log_path = os.path.join(job_archive_dir, 'teuthology.log') + if os.path.exists(log_path): + mtime = int(os.path.getmtime(log_path)) + mtime_dt = datetime.fromtimestamp(mtime) + job_info['updated'] = str(mtime_dt) + if 'job_id' not in job_info: job_info['job_id'] = job_id -- 2.39.5