

def main(argv):
    if (not FLAGS.dbspec):
        raise app.UsageError('You must specify a dbspec.')
    dbspec = db.Spec.Parse(FLAGS.dbspec)
    logging.info('Heartbeat starting up...')
    while True:
        signal.alarm((FLAGS.connection_lifetime * 2))
        with dbspec.Connect() as dbh:
            dbh.ExecuteOrDie('SET AUTOCOMMIT=1;')
            DoHeartbeat(dbh, FLAGS.interval, FLAGS.connection_lifetime)
        logging.info("Feelin' fine, reconnecting...")

dataset/ETHPy150Open google/mysql-tools/replication_heartbeat.py main/original