Skip to content

Commit

Permalink
added require manifest option to transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed May 24, 2024
1 parent 855fb9f commit e213b06
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions xnat_ingest/cli/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
help="The XNAT server to upload to plus the user and password to use",
envvar="XNAT_INGEST_TRANSFER_XNAT_LOGIN",
)
@click.option(
"--require-manifest/--dont-require-manifest",
default=False,
help="Whether to require a manifest file to be present in the session directory",
envvar="XNAT_INGEST_TRANSFER_REQUIRE_MANIFEST",
)
def transfer(
staging_dir: Path,
remote_store: str,
Expand All @@ -122,6 +128,7 @@ def transfer(
delete: bool,
raise_errors: bool,
xnat_login: ty.Optional[XnatLogin],
require_manifest: bool,
):

if not staging_dir.exists():
Expand Down Expand Up @@ -201,6 +208,16 @@ def transfer(
project_dir.name,
)
continue
if require_manifest and not (session_dir / "MANIFEST.yaml").exists():
logger.warning(
"Session %s in subject %s in project %s does not contain a "
"'MANIFEST.yaml' and is therefore considered be incomplete and "
"will not be synced",
session_dir.name,
subject_dir.name,
project_dir.name,
)
continue
remote_path = (
remote_store
+ "/"
Expand All @@ -226,6 +243,7 @@ def transfer(
aws_cmd,
"s3",
"sync",
"--quiet",
str(session_dir),
remote_path,
],
Expand Down

0 comments on commit e213b06

Please sign in to comment.