Adding in cancel for a build that is building.
This commit is contained in:
parent
e57eece6c1
commit
fd7c566d31
7 changed files with 120 additions and 16 deletions
25
buildman/manager/buildcanceller.py
Normal file
25
buildman/manager/buildcanceller.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import logging
|
||||
|
||||
from buildman.manager.etcd_canceller import EtcdCanceller
|
||||
from buildman.manager.noop_canceller import NoopCanceller
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CANCELLERS = {'ephemeral': EtcdCanceller}
|
||||
|
||||
|
||||
class BuildCanceller(object):
|
||||
""" A class to manage cancelling a build """
|
||||
|
||||
def __init__(self, app=None):
|
||||
build_manager_config = app.config.get('BUILD_MANAGER')
|
||||
if app is None or build_manager_config is None:
|
||||
self.handler = NoopCanceller()
|
||||
return
|
||||
|
||||
canceller = CANCELLERS.get(build_manager_config[0], NoopCanceller)
|
||||
self.handler = canceller(build_manager_config[1])
|
||||
|
||||
def try_cancel_build(self, uuid):
|
||||
""" A method to kill a running build """
|
||||
return self.handler.try_cancel_build(uuid)
|
Reference in a new issue