Пример #1
0
    def test_get_volume_args_gcs(self):
        gcs_store = V1ConnectionType(
            name="test_gcs",
            kind=V1ConnectionKind.GCS,
            schema=V1BucketConnection(bucket="gs//:foo"),
        )
        path_to = "/path/to/"
        path_from = os.path.join(gcs_store.store_path, "")
        assert get_volume_args(gcs_store, path_to, None) == "; ".join([
            get_or_create_args(path=path_to),
            cp_gcs_args(path_from=path_from, path_to=path_to, is_file=False),
        ])

        gcs_store = V1ConnectionType(
            name="test_gcs",
            kind=V1ConnectionKind.GCS,
            schema=V1BucketConnection(bucket="Congs//:foo"),
        )

        base_path = "/path/to/"
        path_to1 = "/path/to/path1"
        path_to2 = "/path/to/path2"
        path_from1 = os.path.join(gcs_store.store_path, "path1")
        path_from2 = os.path.join(gcs_store.store_path, "path2")
        assert get_volume_args(
            gcs_store,
            "/path/to",
            artifacts=V1ArtifactsType(dirs=["path1", "path2"])) == "; ".join([
                get_or_create_args(path=base_path),
                cp_gcs_args(path_from=path_from1,
                            path_to=path_to1,
                            is_file=False),
                get_or_create_args(path=base_path),
                cp_gcs_args(path_from=path_from2,
                            path_to=path_to2,
                            is_file=False),
            ])
Пример #2
0
 def test_dirs_cp_gcs_args(self):
     assert cp_gcs_args(
         path_from="gcs://foo", path_to="/local", is_file=False
     ) == (
         "polyaxon initializer gcs --path_from=gcs://foo --path_to=/local ")
Пример #3
0
 def test_files_cp_gcs_args(self):
     assert cp_gcs_args(
         path_from="gcs://foo", path_to="/local", is_file=True
     ) == (
         "polyaxon initializer gcs --path-from=gcs://foo --path-to=/local --is-file;"
     )