in src/workflow/lambda.py [0:0]
def _create_kernel_image(self, cb_project, timeout) :
## limit build execution to once every 100 seconds as a protective
## measure for the unexpected.
token = str(int(datetime.now().timestamp()/100)*100)
start = time()
response = self.cb.start_build(projectName=cb_project, idempotencyToken=token)
if response :
build_id = response["build"]["id"]
else :
raise Exception("Failed to start the build.")
while True :
info = self.cb.batch_get_builds(ids= [build_id])["builds"][0]
if info :
status = info["buildStatus"]
if status == 'SUCCEEDED':
self.update_and_next(info)
break
elif status == 'FAILED' or status == 'FAULT' or status == 'STOPPED' or status == 'TIMED_OUT':
self.update_and_next(info)
raise Exception(f"Build Id: {build_id} Status: {status}")
self._handle_wait(start, timeout)