def refresh(source, stamp, cmd):
  try:
    if os.path.getmtime(source) == os.path.getmtime(stamp):
      return
  except:
    pass

  try:
    exec_cmd(cmd)
    ensure_dir(os.path.dirname(stamp))
    open(stamp, 'a').close()  # ensure the stamp file exists
    os.utime(stamp, (os.path.getatime(source), os.path.getmtime(source)))
  except:
    logging.exception('unable to generate files')
    try:
      os.unlink(stamp)
    except:
      pass
dataset/ETHPy150Open viewfinderco/viewfinder/__init__.py/refresh/original