copr-be: copr-ping: faster recovery
When the last build succeeds, the nrpe service should recover immediately. Also refine some of the log messages.
This commit is contained in:
parent
4faf14ea89
commit
f8e3bdee6b
1 changed files with 9 additions and 4 deletions
|
@ -63,6 +63,9 @@ def _main(context):
|
||||||
|
|
||||||
builds_checked = 0
|
builds_checked = 0
|
||||||
while last_lines.queue:
|
while last_lines.queue:
|
||||||
|
# re-set the state, only the last matters
|
||||||
|
context.status = EXIT_OK
|
||||||
|
|
||||||
builds_checked += 1
|
builds_checked += 1
|
||||||
|
|
||||||
line = last_lines.get()
|
line = last_lines.get()
|
||||||
|
@ -81,21 +84,23 @@ def _main(context):
|
||||||
LOG.error("some values not set in %s", FILE)
|
LOG.error("some values not set in %s", FILE)
|
||||||
sys.exit(EXIT_CRITICAL)
|
sys.exit(EXIT_CRITICAL)
|
||||||
|
|
||||||
|
build_id = values["build_id"]
|
||||||
start = int(values["start"])
|
start = int(values["start"])
|
||||||
stop = int(values["stop"])
|
stop = int(values["stop"])
|
||||||
took = stop - start
|
took = stop - start
|
||||||
if took > ERR_TIME:
|
if took > ERR_TIME:
|
||||||
error(context, "Attempt to build took %ss (allowed %s)", took, WARN_TIME)
|
error(context, "Build %s took %ss (allowed %s)", build_id, took,
|
||||||
|
WARN_TIME)
|
||||||
elif took > WARN_TIME:
|
elif took > WARN_TIME:
|
||||||
warning(context, "Attempt to build took %ss (allowed %s)", took, WARN_TIME)
|
warning(context, "Build %s took %ss (allowed %s)", build_id, took,
|
||||||
|
WARN_TIME)
|
||||||
|
|
||||||
if int(values["exit_status"]) != 0:
|
if int(values["exit_status"]) != 0:
|
||||||
error(context, "Exit status is %s (non-zero) for build ID %s",
|
error(context, "Exit status is %s (non-zero) for build ID %s",
|
||||||
values["exit_status"], values["build_id"])
|
values["exit_status"], values["build_id"])
|
||||||
|
|
||||||
if context.status == EXIT_OK:
|
if context.status == EXIT_OK:
|
||||||
LOG.info("Last %s attempts to build copr-ping succeeded!",
|
LOG.info("The last build %s for copr-ping succeeded", build_id)
|
||||||
builds_checked)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue