code: def main(unused_argv):
    
  
    print('Wiping dir %s' % FLAGS.base_dir, flush=True)
    shutil.rmtree(FLAGS.base_dir, ignore_errors=True)
    dirs = [fsdb.models_dir(), fsdb.selfplay_dir(), fsdb.holdout_dir(),
            fsdb.eval_dir(), fsdb.golden_chunk_dir(), fsdb.working_dir()]
    for d in dirs:
      ensure_dir_exists(d);
  
    # Copy the flag files so there's no chance of them getting accidentally
    # overwritten while the RL loop is running.
    flags_dir = os.path.join(FLAGS.base_dir, 'flags')
    shutil.copytree(FLAGS.flags_dir, flags_dir)
    FLAGS.flags_dir = flags_dir
  
    # Copy the target model to the models directory so we can find it easily.
    shutil.copy(FLAGS.target_path, os.path.join(fsdb.models_dir(), 'target.pb'))
  
    logging.getLogger().addHandler(
        logging.FileHandler(os.path.join(FLAGS.base_dir, 'rl_loop.log')))
    formatter = logging.Formatter('[%(asctime)s] %(message)s',
                                  '%Y-%m-%d %H:%M:%S')
    for handler in logging.getLogger().handlers:
      handler.setFormatter(formatter)
  
    with logged_timer('Total time'):
      try:
        rl_loop()
      finally:
        asyncio.get_event_loop().close()
docs: Run the reinforcement learning loop.