Esempio n. 1
0
 def test_check_no_overlapping_paths_unique_paths(self):
     paths = [
         "/he/went/to/the/store", "/she/saw/a/movie",
         "/no/one/knew/where/to/go"
     ]
     # This test is successful if nothing happens when calling check_no_overlapping_paths(paths)
     check_no_overlapping_paths(paths)
Esempio n. 2
0
    def materialize_directories(
        self, directories_to_materialize: Tuple[DirectoryToMaterialize, ...]
    ) -> MaterializeDirectoriesResult:
        """Materialize multiple directory digests to disk in parallel."""
        # Ensure that there isn't more than one of the same directory paths and paths do not have the
        # same prefix.
        dir_list = [dtm.path_prefix for dtm in directories_to_materialize]
        check_no_overlapping_paths(dir_list)

        result: MaterializeDirectoriesResult = self._scheduler._native.lib.materialize_directories(
            self._scheduler._scheduler,
            self._session,
            _DirectoriesToMaterialize(directories_to_materialize),
        )
        return result
Esempio n. 3
0
  def materialize_directories(self, directories_paths_and_digests):
    """Creates the specified directories on the file system.

    :param directories_paths_and_digests tuple<DirectoryToMaterialize>: Tuple of the path and
           digest of the directories to materialize.
    :returns: Nothing or an error.
    """
    # Ensure there isn't more than one of the same directory paths and paths do not have the same prefix.
    dir_list = [dpad.path for dpad in directories_paths_and_digests]
    check_no_overlapping_paths(dir_list)

    result = self._native.lib.materialize_directories(
      self._scheduler,
      self._to_value(_DirectoriesToMaterialize(directories_paths_and_digests)),
    )
    return self._raise_or_return(result)
Esempio n. 4
0
  def materialize_directories(self, directories_paths_and_digests):
    """Creates the specified directories on the file system.

    :param directories_paths_and_digests tuple<DirectoryToMaterialize>: Tuple of the path and
           digest of the directories to materialize.
    :returns: Nothing or an error.
    """
    # Ensure there isn't more than one of the same directory paths and paths do not have the same prefix.
    dir_list = [dpad.path for dpad in directories_paths_and_digests]
    check_no_overlapping_paths(dir_list)

    result = self._native.lib.materialize_directories(
      self._scheduler,
      self._to_value(_DirectoriesToMaterialize(directories_paths_and_digests)),
    )
    return self._raise_or_return(result)
Esempio n. 5
0
 def test_check_no_overlapping_paths_prefix(self):
     paths = ["/path/to", "/path/to/file", "/no/path/to/file"]
     with self.assertRaises(ValueError):
         check_no_overlapping_paths(paths)
Esempio n. 6
0
 def test_check_no_overlapping_paths_two_same(self) -> None:
     paths = ["/path/to/file", "/path/to/file", "/no/path/to/file"]
     with self.assertRaises(ValueError):
         check_no_overlapping_paths(paths)
Esempio n. 7
0
 def test_check_no_overlapping_paths_unique_paths(self):
   paths = ["/he/went/to/the/store", "/she/saw/a/movie", "/no/one/knew/where/to/go"]
   # This test is successful if nothing happens when calling check_no_overlapping_paths(paths)
   check_no_overlapping_paths(paths)
Esempio n. 8
0
 def test_check_no_overlapping_paths_prefix(self):
   paths = ["/path/to", "/path/to/file", "/no/path/to/file"]
   with self.assertRaises(ValueError):
     check_no_overlapping_paths(paths)