def test(self): cloud = DataCloudHTTP(CloudSettings(None, None)) path = 'out' url = 'https://github.com/dataversioncontrol/dvc/LICENSE' ret = cloud.import_data(url, path) self.assertEqual(ret, path) self.assertTrue(os.path.exists(path)) self.assertTrue(os.path.isfile(path))
def get_cloud_settings(config, cloud_type, path_factory): if cloud_type not in config.keys(): cloud_config = None else: cloud_config = config[cloud_type] global_storage_path = config['Global'].get('StoragePath', None) cloud_settings = CloudSettings(path_factory, global_storage_path, cloud_config) return cloud_settings
def _setup_cloud(self): if not self._should_test(): return repo = self.TEST_REPO_BUCKET + '/' + str(uuid.uuid4()) # Setup cloud config = {'StoragePath': repo, 'Region': self.TEST_REPO_REGION} cloud_settings = CloudSettings(self.dvc.cache, None, config) self.cloud = DataCloudAWS(cloud_settings)
def get_cloud_settings(config, cloud_type): """ Obtain cloud settings from config. """ if cloud_type not in config.keys(): cloud_config = None else: cloud_config = config[cloud_type] global_storage_path = config['Global'].get('StoragePath', None) cloud_settings = CloudSettings(global_storage_path, cloud_config) return cloud_settings
def _setup_cloud(self): if not self._should_test(): return # Cleanup os.system("gsutil rm -rf gs://{}/".format(self.TEST_REPO_GCP)) # Setup cloud config = { 'StoragePath': self.TEST_REPO_GCP, 'Region': self.TEST_REPO_GCP_PROJECT } cloud_settings = CloudSettings(None, config) self.cloud = DataCloudGCP(cloud_settings)
def _setup_cloud(self): if not self._should_test(): return if os.getenv("GOOGLE_APPLICATION_CREDENTIALS") and os.getenv("GCP_CREDS"): shutil.copyfile(self.GCP_CREDS_FILE, os.getenv("GOOGLE_APPLICATION_CREDENTIALS")) repo = self.TEST_REPO_GCP_BUCKET + '/' + str(uuid.uuid4()) # Setup cloud config = {'StoragePath': repo, 'Region': self.TEST_REPO_GCP_PROJECT} cloud_settings = CloudSettings(self.dvc.cache, None, config) self.cloud = DataCloudGCP(cloud_settings)
def _setup_cloud(self): self.dname = 'cloud' os.mkdir(self.dname) config = {'StoragePath': self.dname} cloud_settings = CloudSettings(self.dvc.cache, None, config) self.cloud = DataCloudLOCAL(cloud_settings)