EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 50d2518a authored by Lubomir Dolezal's avatar Lubomir Dolezal
Browse files

check for empty upload earlier

parent d28b76a1
No related branches found
No related tags found
No related merge requests found
...@@ -223,6 +223,10 @@ def preprocess_file(config: dict, file_path: os.PathLike, use_dir: os.PathLike=N ...@@ -223,6 +223,10 @@ def preprocess_file(config: dict, file_path: os.PathLike, use_dir: os.PathLike=N
uploader = get_uploader( uploader = get_uploader(
target_config['type'], target_config.get('args'), target_config.get('kwargs') target_config['type'], target_config.get('args'), target_config.get('kwargs')
) )
if len(os.listdir('upload')) == 0:
# end here, so not only metadata file is uploaded
raise Exception('No data files to upload, aborting.')
paths_for_upload = ['upload', 'extra'] paths_for_upload = ['upload', 'extra']
upload_filenames = [] upload_filenames = []
for path_to_upload in paths_for_upload: for path_to_upload in paths_for_upload:
......
...@@ -65,8 +65,6 @@ class Uploader(Base): ...@@ -65,8 +65,6 @@ class Uploader(Base):
""" """
def upload(self, local_path: Union[os.PathLike, List[os.PathLike]], remote_dir: os.PathLike) -> List[os.PathLike]: def upload(self, local_path: Union[os.PathLike, List[os.PathLike]], remote_dir: os.PathLike) -> List[os.PathLike]:
paths = local_path if isinstance(local_path, List) else [local_path] paths = local_path if isinstance(local_path, List) else [local_path]
if len(paths) == 0:
raise Exception('No files are were found to be uploaded.')
remote_paths = [ remote_paths = [
os.path.join( os.path.join(
remote_dir, remote_dir,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment