<commit_before>"""Module installing, mounting and unmounting gcsfuse."""

from absl import flags

FLAGS = flags.FLAGS

flags.DEFINE_string('gcsfuse_version', '0.35.0', 'The version of the gcsfuse.')
flags.DEFINE_string('gcsfuse_options', '--implicit-dirs',
                    'The options used to mount gcsfuse.')

PACKAGE_LOCAL = '/tmp/gcsfuse.deb'
MNT = '/gcs'


def _PackageUrl():
  return 'https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v{v}/gcsfuse_{v}_amd64.deb'.format(
      v=FLAGS.gcsfuse_version)


def AptInstall(vm):
  """Installs the gcsfuse package and mounts gcsfuse.

  Args:
    vm: BaseVirtualMachine. VM to receive the scripts.
  """
  vm.InstallPackages('wget')
  vm.RemoteCommand('wget -O {local} {url}'.format(
      local=PACKAGE_LOCAL, url=_PackageUrl()))

  vm.InstallPackages(PACKAGE_LOCAL)

  vm.RemoteCommand(
      'sudo mkdir -p {mnt} && sudo chmod a+w {mnt}'.format(mnt=MNT))
  vm.RemoteCommand('gcsfuse {opts} {mnt}'.format(
      opts=FLAGS.gcsfuse_options, mnt=MNT))


def Uninstall(vm):
  """Unmounts gcsfuse.

  Args:
    vm: BaseVirtualMachine. VM to receive the scripts.
  """
  vm.RemoteCommand('sudo umount {mnt}'.format(mnt=MNT))<commit_msg>Avoid package installation failure in gcsfuse benchmark<commit_after>"""Module installing, mounting and unmounting gcsfuse."""

from absl import flags

FLAGS = flags.FLAGS

flags.DEFINE_string('gcsfuse_version', '0.35.1', 'The version of the gcsfuse.')
flags.DEFINE_string('gcsfuse_options', '--implicit-dirs',
                    'The options used to mount gcsfuse.')

PACKAGE_LOCAL = '/tmp/gcsfuse.deb'
MNT = '/gcs'


def _PackageUrl():
  return 'https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v{v}/gcsfuse_{v}_amd64.deb'.format(
      v=FLAGS.gcsfuse_version)


def AptInstall(vm):
  """Installs the gcsfuse package and mounts gcsfuse.

  Args:
    vm: BaseVirtualMachine. VM to receive the scripts.
  """
  vm.InstallPackages('wget')
  vm.RemoteCommand('wget -O {local} {url}'.format(
      local=PACKAGE_LOCAL, url=_PackageUrl()))

  vm.RemoteCommand(
      f'sudo apt-get install -y --allow-downgrades {PACKAGE_LOCAL}')

  vm.RemoteCommand(
      'sudo mkdir -p {mnt} && sudo chmod a+w {mnt}'.format(mnt=MNT))
  vm.RemoteCommand('gcsfuse {opts} {mnt}'.format(
      opts=FLAGS.gcsfuse_options, mnt=MNT))


def Uninstall(vm):
  """Unmounts gcsfuse.

  Args:
    vm: BaseVirtualMachine. VM to receive the scripts.
  """
  vm.RemoteCommand('sudo umount {mnt}'.format(mnt=MNT))
{'fraction_non_alphanumeric': 0.14365746298519408, 'fraction_numerical': 0.004801920768307323, 'mean_word_length': 4.1020408163265305, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5649438', 'n_tokens_mistral': 952, 'n_tokens_neox': 891, 'n_words': 191}