Skip to content

Commit

Permalink
Merge pull request #784 from hubmapconsortium/sunset666/bugfixes
Browse files Browse the repository at this point in the history
Extras directory support on Upload data folder
  • Loading branch information
sunset666 authored Oct 27, 2023
2 parents 25b95f9 + 741d872 commit 72f907b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/ingest-pipeline/airflow/dags/reorganize_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@

from misc.tools.split_and_create import reorganize

sys.path.append(airflow_conf.as_dict()['connections']['SRC_PATH']
.strip("'").strip('"'))
sys.path.pop()

# Following are defaults which can be overridden later on
default_args = {
Expand Down
13 changes: 11 additions & 2 deletions src/ingest-pipeline/misc/tools/split_and_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,19 @@ def populate(row, source_entity, entity_factory, dryrun=False):
extras_path.mkdir(0o770)
source_data_path = source_entity.full_path / old_data_path
for elt in source_data_path.glob('*'):
dst_file = kid_path / elt.name
if dryrun:
print(f'rename {elt} to {kid_path / elt.name}')
if dst_file.exists() and dst_file.is_dir():
for sub_elt in elt.glob('*'):
print(f'rename {sub_elt} to {kid_path / elt.name / sub_elt.name}')
continue
print(f'rename {elt} to {dst_file}')
else:
elt.rename(kid_path / elt.name)
if dst_file.exists() and dst_file.is_dir():
for sub_elt in elt.glob('*'):
sub_elt.rename(kid_path / elt.name / sub_elt.name)
continue
elt.rename(dst_file)
if dryrun:
print(f'copy {old_contrib_path} to {extras_path}')
else:
Expand Down

0 comments on commit 72f907b

Please sign in to comment.