Sort recent builds by age by default.
[amitay/build-farm.git] / tools / fix-status.py
1 #!/usr/bin/python
2
3 from buildfarm.data import build_status_from_logs, LogFileMissing
4
5 from buildfarm.sqldb import StormCachingBuildFarm, StormBuild
6
7 x = StormCachingBuildFarm()
8
9 store = x._get_store()
10 for build in store.find(StormBuild, StormBuild.status_str == None):
11     try:
12         log = build.read_log()
13     except LogFileMissing:
14         log.remove()
15         continue
16     try:
17         err = build.read_err()
18         try:
19             status = build_status_from_logs(log, err)
20         finally:
21             err.close()
22     finally:
23         log.close()
24     build.status_str = status.__serialize__()