Example #1
0
 def test_match_by_path(self):
     self.assertEqual(
         ArtifactDriversMap.match_path("file:///path/to/"), LocalArtifactDriver
     )
     self.assertEqual(
         ArtifactDriversMap.match_path("/path/to/"), LocalArtifactDriver
     )
Example #2
0
 def download(self, destination: str = None):
     self._check_feature()
     for file_definition in self.fetch_files_list():
         driver: typing.Type[ArtifactDriver] = ArtifactDriversMap.match_type(
             file_definition.type
         )
         file_destination = pathlib.Path(destination or ".") / pathlib.Path(
             file_definition.file_path
         )
         file_destination.parent.mkdir(parents=True, exist_ok=True)
         driver.download_file(file_destination, file_definition)
Example #3
0
def _extract_file_list(
        path: List[str],
        entries: List[Tuple[str, Optional[str]]]) -> List[ArtifactFileData]:
    files: List[ArtifactFileData] = list()

    for entry_path, entry_destination in entries:
        driver: Type[ArtifactDriver] = ArtifactDriversMap.match_path(
            entry_path)
        artifact_files = driver.get_tracked_files(
            path=entry_path, destination=entry_destination)

        if len(artifact_files) == 0:
            raise NeptuneEmptyLocationException(location=entry_path,
                                                namespace="/".join(path))

        files.extend(artifact_files)

    return files
Example #4
0
 def test_match_by_type(self):
     self.assertEqual(ArtifactDriversMap.match_type("Local"), LocalArtifactDriver)
Example #5
0
    def test_match_by_type(self):
        driver_instance = ArtifactDriversMap.match_type("test")

        self.assertEqual(driver_instance, self.test_driver_instance)
Example #6
0
 def test_unmatched_path_raises_exception(self):
     with self.assertRaises(NeptuneUnhandledArtifactSchemeException):
         ArtifactDriversMap.match_path("test2://path/to/file")
Example #7
0
    def test_match_by_path(self):
        driver_instance = ArtifactDriversMap.match_path("test://path/to/file")

        self.assertEqual(driver_instance, self.test_driver_instance)
Example #8
0
 def test_unmatched_type_raises_exception(self):
     with self.assertRaises(NeptuneUnhandledArtifactTypeException):
         ArtifactDriversMap.match_type("test2")
Example #9
0
 def test_match_by_type(self):
     self.assertEqual(ArtifactDriversMap.match_type("S3"), S3ArtifactDriver)
Example #10
0
 def test_match_by_path(self):
     self.assertEqual(
         ArtifactDriversMap.match_path(f"s3://{self.bucket_name}/path/to/"),
         S3ArtifactDriver,
     )