Minor polishing

This commit is contained in:
Josef Skladanka 2015-02-18 11:33:45 +01:00
parent 6c04ca5904
commit 49c3e75edf

View File

@ -98,13 +98,14 @@ def jobs_from_current(wiki):
else: else:
runarches.append(arch) runarches.append(arch)
json_parsed[arch] = currev.sortname json_parsed[arch] = currev.sortname
jobs = jobs_from_fedfind(currev.ff_release, runarches)
# write info about latest versions # write info about latest versions
f = open(PERSISTENT, "w") f = open(PERSISTENT, "w")
f.write(json.dumps(json_parsed)) f.write(json.dumps(json_parsed))
f.close() f.close()
jobs = jobs_from_fedfind(currev.ff_release, runarches)
return (jobs, currev) return (jobs, currev)
def jobs_from_fedfind(ff_release, arches=VERSIONS): def jobs_from_fedfind(ff_release, arches=VERSIONS):
@ -138,7 +139,7 @@ def run_current(args, wiki):
"""run OpenQA for current release validation event, if we have """run OpenQA for current release validation event, if we have
not already done it. not already done it.
""" """
jobs = jobs_from_current(wiki)[0] jobs, _ = jobs_from_current(wiki)
# wait for jobs to finish and display results # wait for jobs to finish and display results
if jobs: if jobs:
print jobs print jobs
@ -172,28 +173,24 @@ def run_all(args, wiki=None):
if they exist, and test current compose if it's different from if they exist, and test current compose if it's different from
either and it's new. either and it's new.
""" """
jobs = []
skip = None skip = None
(currjobs, currev) = jobs_from_current(wiki) (jobs, currev) = jobs_from_current(wiki)
print("Jobs from current validation event: {0}".format(currjobs)) print("Jobs from current validation event: {0}".format(jobs))
jobs.extend(currjobs)
utcdate = datetime.datetime.utcnow() yesterday = datetime.datetime.utcnow() - datetime.timedelta(days=1)
day = datetime.timedelta(days=1) if currev and currev.compose == yesterday.strftime('%Y%m%d'):
utcdate = utcdate - day
if currev and currev.compose == utcdate.strftime('%Y%m%d'):
skip = currev.milestone skip = currev.milestone
if not skip.lower() == 'rawhide': if not skip.lower() == 'rawhide':
rawhide_ffrel = fedfind.release.get_release( rawhide_ffrel = fedfind.release.get_release(
release='Rawhide', compose=utcdate) release='Rawhide', compose=yesterday)
rawjobs = jobs_from_fedfind(rawhide_ffrel) rawjobs = jobs_from_fedfind(rawhide_ffrel)
print("Jobs from {0}: {1}".format(rawhide_ffrel.version, rawjobs)) print("Jobs from {0}: {1}".format(rawhide_ffrel.version, rawjobs))
jobs.extend(rawjobs) jobs.extend(rawjobs)
if not skip.lower() == 'branched': if not skip.lower() == 'branched':
branched_ffrel = fedfind.release.get_release( branched_ffrel = fedfind.release.get_release(
release=currev.release, compose=utcdate) release=currev.release, compose=yesterday)
branchjobs = jobs_from_fedfind(branched_ffrel) branchjobs = jobs_from_fedfind(branched_ffrel)
print("Jobs from {0}: {1}".format(branched_ffrel.version, branchjobs)) print("Jobs from {0}: {1}".format(branched_ffrel.version, branchjobs))
jobs.extend(branchjobs) jobs.extend(branchjobs)
@ -247,7 +244,6 @@ if __name__ == "__main__":
"and today's Rawhide and Branched nightly's (if found).") "and today's Rawhide and Branched nightly's (if found).")
parser_all.add_argument( parser_all.add_argument(
'-t', '--test', help=test_help, required=False, action='store_true') '-t', '--test', help=test_help, required=False, action='store_true')
parser_current.set_defaults(func=run_current)
parser_all.set_defaults(func=run_all) parser_all.set_defaults(func=run_all)
args = parser.parse_args() args = parser.parse_args()