def cancelJobInQueue(self, build): job = build.__gearman_job req = gear.CancelJobAdminRequest(job.handle) job.connection.sendAdminRequest(req) self.log.debug("Response to cancel build %s request: %s" % (build, req.response.strip())) if req.response.startswith("OK"): try: del self.builds[job.unique] except: pass return True return False
def cancelJobInQueue(self, build): job = build.__gearman_job req = gear.CancelJobAdminRequest(job.handle) job.connection.sendAdminRequest(req, timeout=300) self.log.debug("Response to cancel build %s request: %s" % (build, req.response.strip())) if req.response.startswith(b"OK"): try: del self.builds[job.unique] except Exception: pass # Since this isn't otherwise going to get a build complete # event, send one to the scheduler so that it can unlock # the nodes. self.sched.onBuildCompleted(build, 'CANCELED', {}) return True return False