mirror of
https://github.com/rocky-linux/createhdds.git
synced 2024-12-22 10:08:30 +00:00
CLI commands should exit-fail if no jobs scheduled
Summary: Have the backing functions always raise TriggerExceptions if no jobs could be scheduled, and have the CLI command functions just quit (with exit code 1) immediately when this happens. I don't see any value to logging the errors and continuing to run, nothing useful is going to happen with no jobs. This allows us to have the 'current' cronjob run the compose report: we just have it do: openqa_trigger.py current && check-compose then it won't generate a compose report every time it runs, but only when the current compose changed and some jobs ran. Test Plan: Well, just make sure things quit or run as intended, I guess. Reviewers: jskladan, garretraziel Reviewed By: garretraziel Differential Revision: https://phab.qadevel.cloud.fedoraproject.org/D541
This commit is contained in:
parent
0396d70de0
commit
2c09f465e1
@ -119,17 +119,17 @@ def jobs_from_current(wiki, client):
|
|||||||
|
|
||||||
jobs = []
|
jobs = []
|
||||||
|
|
||||||
try:
|
if not runarches:
|
||||||
jobs = jobs_from_fedfind(currev.ff_release, client, runarches)
|
raise TriggerException("Skipped all arches, nothing to do.")
|
||||||
logging.info("planned jobs: %s", ' '.join(str(j) for j in jobs))
|
|
||||||
|
|
||||||
# write info about latest versions
|
jobs = jobs_from_fedfind(currev.ff_release, client, runarches)
|
||||||
f = open(PERSISTENT, "w")
|
logging.info("planned jobs: %s", ' '.join(str(j) for j in jobs))
|
||||||
f.write(json.dumps(json_parsed))
|
|
||||||
f.close()
|
# write info about latest versions
|
||||||
logging.debug("written info about newest version")
|
f = open(PERSISTENT, "w")
|
||||||
except TriggerException as e:
|
f.write(json.dumps(json_parsed))
|
||||||
logging.error("cannot run jobs: %s", e)
|
f.close()
|
||||||
|
logging.debug("written info about newest version")
|
||||||
|
|
||||||
return jobs
|
return jobs
|
||||||
|
|
||||||
@ -210,7 +210,11 @@ def run_current(args, client, wiki):
|
|||||||
not already done it.
|
not already done it.
|
||||||
"""
|
"""
|
||||||
logging.info("running on current release")
|
logging.info("running on current release")
|
||||||
jobs = jobs_from_current(wiki, client)
|
try:
|
||||||
|
jobs = jobs_from_current(wiki, client)
|
||||||
|
except TriggerException as e:
|
||||||
|
logging.debug("No jobs run: %s", e)
|
||||||
|
sys.exit(1)
|
||||||
# wait for jobs to finish and display results
|
# wait for jobs to finish and display results
|
||||||
if jobs:
|
if jobs:
|
||||||
logging.info("waiting for jobs: %s", ' '.join(str(j) for j in jobs))
|
logging.info("waiting for jobs: %s", ' '.join(str(j) for j in jobs))
|
||||||
@ -260,7 +264,8 @@ def run_compose(args, client, wiki=None):
|
|||||||
else:
|
else:
|
||||||
jobs = jobs_from_fedfind(ff_release, client)
|
jobs = jobs_from_fedfind(ff_release, client)
|
||||||
except TriggerException as e:
|
except TriggerException as e:
|
||||||
logging.error("cannot run jobs: %s", e)
|
logging.debug("No jobs run: %s", e)
|
||||||
|
sys.exit(1)
|
||||||
logging.info("planned jobs: %s", ' '.join(str(j) for j in jobs))
|
logging.info("planned jobs: %s", ' '.join(str(j) for j in jobs))
|
||||||
if args.submit_results:
|
if args.submit_results:
|
||||||
report_results(jobs, client)
|
report_results(jobs, client)
|
||||||
|
Loading…
Reference in New Issue
Block a user