code: def transition_complete(self, pipeline_key):
      
      def txn():
        pipeline_record = db.get(pipeline_key)
        if pipeline_record is None:
          logging.warning(
              'Tried to mark pipeline ID "%s" as complete but it does not exist.',
              pipeline_key.name())
          raise db.Rollback()
        if pipeline_record.status not in (
            _PipelineRecord.WAITING, _PipelineRecord.RUN):
          logging.warning(
              'Tried to mark pipeline ID "%s" as complete, found bad state: %s',
              pipeline_key.name(), pipeline_record.status)
          raise db.Rollback()
  
        pipeline_record.status = _PipelineRecord.DONE
        pipeline_record.finalized_time = self._gettime()
        pipeline_record.put()
  
      db.run_in_transaction(txn)
docs: Marks the given pipeline as complete.
  
      Does nothing if the pipeline is no longer in a state that can be completed.
  
      Args:
        pipeline_key: db.Key of the _PipelineRecord that has completed.