Skip to content

Commit

Permalink
BaseImport FileSystemStorage 지원
Browse files Browse the repository at this point in the history
  • Loading branch information
enoch2110 committed Aug 24, 2023
1 parent 7acde97 commit b21a187
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion datamaker/plugins/imports.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pathlib import Path

from datamaker.plugins import BasePlugin


Expand Down Expand Up @@ -35,7 +37,7 @@ def import_dataset(self):
dataset_id = self.target_id

dataset = self.client.get_dataset(dataset_id)
storage = self.client.get_storage(self.storage_id)
storage = self.get_storage()
allowed_extensions = dataset['allowed_extensions']

dataset = self.prepare_dataset(
Expand All @@ -47,3 +49,19 @@ def import_dataset(self):
project_id=project_id,
batch_size=self.batch_size,
)

def get_storage(self):
# TODO support multiple storages
class FileSystemStorage:
def __init__(self, location):
self.location = location

def get_pathlib(self):
return Path(self.location)

storage = self.client.get_storage(self.storage_id)
assert (
storage['provider'] == 'file_system'
and 'location' in storage['configuration']
)
return FileSystemStorage(storage['configuration']['location'])

0 comments on commit b21a187

Please sign in to comment.