]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Report job updated time
authorZack Cerza <zack@cerza.org>
Tue, 1 Apr 2014 02:57:53 +0000 (21:57 -0500)
committerZack Cerza <zack@cerza.org>
Tue, 1 Apr 2014 04:12:34 +0000 (23:12 -0500)
When reading job information from archive files, use the mtime of
teuthology.log as the job updated time

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/report.py

index 6fb84be92ed9098d6108f40b989825899812c348..d684680f7e0ee0d38a3cd62c7d7271a04409f804 100644 (file)
@@ -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