def execute_garbage_collection(self, app_id, app_path):
    start = time.time()
    # Get the transaction ID list.
    txrootpath = PATH_SEPARATOR.join([app_path, APP_TX_PATH])
    try:
      txlist = self.run_with_retry(self.handle.get_children, txrootpath)
    except kazoo.exceptions.NoNodeError:
      # there is no transaction yet.
      return
    except kazoo.exceptions.ZookeeperError as zk_exception:
      logging.exception(zk_exception)
      self.reestablish_connection()
      return
    except kazoo.exceptions.KazooException as kazoo_exception:
      logging.exception(kazoo_exception)
      self.reestablish_connection()
      return
    except Exception as exception:
      logging.error("UNKNOWN EXCEPTION")
      logging.exception(exception)
      self.reestablish_connection()
      return
    # Verify the time stamp of each transaction.
    for txid in txlist:
      if not re.match("^" + APP_TX_PREFIX + '\d', txid):
        logging.debug("Skipping {0} because it is not a transaction.".format(
          txid))
        continue

      txpath = PATH_SEPARATOR.join([txrootpath, txid])

      try:
        txtime = float(self.run_with_retry(self.handle.get, txpath)[0])
        # If the timeout plus our current time is in the future, then
        # we have not timed out yet.
        if txtime + TX_TIMEOUT < time.time():
          self.notify_failed_transaction(app_id, long(txid.lstrip(
            APP_TX_PREFIX)))
      except kazoo.exceptions.NoNodeError:
        # Transaction id disappeared during garbage collection.
        # The transaction may have finished successfully.
        pass
      except kazoo.exceptions.ZookeeperError as zk_exception:
        logging.exception(zk_exception)
        self.reestablish_connection()
        return
      except kazoo.exceptions.KazooException as kazoo_exception:
        logging.exception(kazoo_exception)
        self.reestablish_connection()
        return
      except Exception as exception:
        logging.error("UNKNOWN EXCEPTION")
        logging.exception(exception)
        self.reestablish_connection()
        return 
    logging.debug("Lock GC took {0} seconds.".format(str(time.time() - start)))
Execute garbage collection for an application.
dataset/ETHPy150Open AppScale/appscale/AppDB/zkappscale/zktransaction.py/ZKTransaction.execute_garbage_collection