cdm_data_loaders.ncbi_ftp.promote ¶
Phase 3: Promote staged files to final Lakehouse paths in S3.
Walks staged files in an S3 staging prefix (written by CTS after Phase 2), uploads each to the final Lakehouse path with MD5 metadata from sidecar files, archives replaced/suppressed and updated assemblies, and trims the transfer manifest so that a re-run of Phase 2 only downloads remaining entries.
promote_from_s3 ¶
promote_from_s3(
*,
staging_bucket: PurePosixPath,
staging_key_prefix: PurePosixPath,
lakehouse_bucket: PurePosixPath,
lakehouse_key_prefix: PurePosixPath,
removed_manifest_path: Path | None = None,
updated_manifest_path: Path | None = None,
manifest_s3_key: PurePosixPath | None = None,
ncbi_release: str | None = None,
dry_run: bool = False
) -> dict[str, Any]
Promote files from an S3 staging prefix to the final Lakehouse path.
Downloads each file to a temp location and re-uploads to the final path
with MD5 metadata from .md5 sidecar files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
staging_bucket
|
PurePosixPath
|
S3 bucket containing the staged files (e.g. |
required |
staging_key_prefix
|
PurePosixPath
|
S3 key prefix where CTS output was written |
required |
lakehouse_bucket
|
PurePosixPath
|
S3 bucket for the final Lakehouse destination (e.g. |
required |
lakehouse_key_prefix
|
PurePosixPath
|
S3 key prefix for final Lakehouse locations |
required |
removed_manifest_path
|
Path | None
|
local path to the removed_manifest file |
None
|
updated_manifest_path
|
Path | None
|
local path to the updated_manifest file |
None
|
manifest_s3_key
|
PurePosixPath | None
|
S3 object key for transfer_manifest.txt (for trimming) |
None
|
ncbi_release
|
str | None
|
NCBI release version tag for archiving |
None
|
dry_run
|
bool
|
if True, log actions without side effects |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
report dict with counts |
Source code in src/cdm_data_loaders/ncbi_ftp/promote.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |