Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions services/datalad/datalad_service/common/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ def setup_s3_backup_sibling_workaround(dataset_path):
def update_s3_sibling(dataset_path):
"""Update S3 remote with latest config."""
# note: enableremote command will only upsert config options, none are deleted
subprocess.run(
['git-annex', 'enableremote', get_s3_remote()]
+ generate_s3_annex_options(dataset_path),
check=True,
cwd=dataset_path,
)
if not is_git_annex_remote(dataset_path, get_s3_remote()):
setup_s3_sibling(dataset_path)
else:
# Update the remote config
subprocess.run(
['git-annex', 'enableremote', get_s3_remote()]
+ generate_s3_annex_options(dataset_path),
check=True,
cwd=dataset_path,
)
# Setup the backup remote if it doesn't exist yet
if not is_git_annex_remote(dataset_path, get_s3_backup_remote()):
setup_s3_backup_sibling_workaround(dataset_path)
Expand Down
9 changes: 5 additions & 4 deletions services/datalad/datalad_service/tasks/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def create_remotes(dataset_path):
github_sibling(dataset_path, dataset)


@broker.task
async def export_backup_and_drop(dataset_path):
"""
Export dataset to S3 backup, verify s3-PUBLIC, and drop local data.
"""
repo = pygit2.Repository(dataset_path)
update_s3_sibling(dataset_path)
tags = sorted(git_tag(repo), key=lambda tag: tag.name)
if tags:
await s3_backup_push(dataset_path)
Expand All @@ -92,13 +94,12 @@ async def export_backup_and_drop(dataset_path):
pipeline = Pipeline(broker, git_annex_fsck_remote).call_next(
annex_drop,
dataset_path=dataset_path,
branch=tag,
remote=get_s3_remote(),
branch=tag.name,
)
# Call the pipeline (arguments for git_annex_fsck_remote)
await pipeline.kiq(
dataset_path,
branch=tag, # Check the history from the new tag just exported
dataset_path=dataset_path,
branch=tag.name,
remote=get_s3_remote(),
)

Expand Down