Adding in a cancel method to the build component so we can properly clean up the job task.

This commit is contained in:
Charlton Austin 2016-12-05 14:56:18 -05:00
parent 3bbd8ca898
commit c6be12e31e
3 changed files with 11 additions and 2 deletions

View file

@ -727,10 +727,12 @@ class EphemeralBuilderManager(BaseManager):
raise Return(False)
got_lock = yield From(self._take_etcd_atomic_lock('job-cancelled', build_uuid, build_info.execution_id))
if got_lock:
yield From(self.kill_builder_executor(build_uuid))
yield From(self.delete_etcd_key(self._etcd_realm_key(build_info.component.builder_realm)))
yield From(self.delete_etcd_key(self._etcd_metric_key(build_info.component.builder_realm)))
yield From(self.delete_etcd_key(os.path.join(self._etcd_job_prefix, build_uuid)))
yield From(self.kill_builder_executor(build_uuid))
# This is outside the lock so we can un-register the component wherever it is registered to.
yield From(build_info.component.cancel_build())
@coroutine
def delete_etcd_key(self, etcd_key):