Adding in cancel notifications

This commit is contained in:
Charlton Austin 2016-11-29 11:48:08 -05:00
parent b7aac159ae
commit 4103a0b75f
9 changed files with 153 additions and 29 deletions

View file

@ -197,6 +197,7 @@ def cancel_repository_build(build, build_queue):
""" This tries to cancel the build returns true if request is successful false if it can't be cancelled """
with db_transaction():
from app import build_canceller
from buildman.jobutil.buildjob import BuildJobNotifier
# Reload the build for update.
# We are loading the build for update so checks should be as quick as possible.
try:
@ -210,6 +211,7 @@ def cancel_repository_build(build, build_queue):
for cancelled in cancel_builds:
if cancelled():
build.phase = BUILD_PHASE.CANCELLED
BuildJobNotifier(build.uuid).send_notification("build_cancelled")
build.save()
return True
build.phase = original_phase