def _start_new_step(self, build, stepname): """Creates the in-memory representation for a newly started step, ready to be persisted to the database. """ step = BuildStep(self.env, build=build.id, name=stepname) step.status = BuildStep.IN_PROGRESS step.started = int(time.time()) step.stopped = 0 return step
elem.attr['status']) db = self.env.get_db_cnx() step = BuildStep(self.env, build=build.id, name=stepname) try: step.started = int(_parse_iso_datetime(elem.attr['time'])) step.stopped = step.started + float(elem.attr['duration']) except ValueError, e: self.log.error('Error parsing build step timestamp: %s', e, exc_info=True) self._send_error(req, HTTP_BAD_REQUEST, e.args[0]) if elem.attr['status'] == 'failure': self.log.warning('Build %s step %s failed', build.id, stepname) step.status = BuildStep.FAILURE if current_step.onerror == 'fail': last_step = True else: step.status = BuildStep.SUCCESS step.errors += [error.gettext() for error in elem.children('error')] step.insert(db=db) # Collect log messages from the request body for idx, log_elem in enumerate(elem.children('log')): build_log = BuildLog(self.env, build=build.id, step=stepname, generator=log_elem.attr.get('generator'), orderno=idx) for message_elem in log_elem.children('message'):