Skip to content

Commit 0e1142f

Browse files
Merge remote-tracking branch 'upstream/main'
2 parents 28e5718 + 937d1c8 commit 0e1142f

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# Mac/OSX system file
22
.DS_Store
3+
4+
# Python
5+
**/__pycache__/

util/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,16 @@ def compare_md5_hashes(results, staging, same_files):
353353
##############################################################
354354
##### PROMOTE WORKFLOW OUTPUTS - STAGING TO PROD SECTION #####
355355
##############################################################
356-
def gcopy(source_path, destination_path):
356+
def gcopy(source_path, destination_path, recursive=False):
357357
command = [
358358
"gcloud",
359359
"storage",
360360
"cp",
361361
source_path,
362362
destination_path
363363
]
364+
if recursive:
365+
command.insert(3, "--recursive")
364366
result = subprocess.run(command, check=True, capture_output=True, text=True)
365367
logging.info(result.stdout)
366368
logging.error(result.stderr)

util/promote_staging_data

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ def main(args):
155155

156156
production_workflow_bucket = f"gs://asap-curated-{team}-{args.source}-{dataset}/{args.workflow_name}"
157157
production_workflow_version_bucket = f"gs://asap-curated-{team}-{args.source}-{dataset}/{args.workflow_name}/archive/workflow_version/{args.workflow_version}"
158+
production_workflow_metadata_path = f"{production_workflow_version_bucket}/workflow_metadata/{formatted_time}"
158159

159160
dev_workflow_metadata_path = f"{staging_dev_bucket}/{args.workflow_name}/archive/workflow_version/{args.workflow_version}/workflow_metadata/{formatted_time}"
160161
uat_workflow_metadata_path = f"{staging_uat_bucket}/{args.workflow_name}/archive/workflow_version/{args.workflow_version}/workflow_metadata/{formatted_time}"
@@ -200,6 +201,12 @@ def main(args):
200201
logging.info(f"\tProduction archive/workflow_version bucket path:\t[{production_workflow_version_bucket}]")
201202
# Dry and real run will only work if staging data gets promoted to production in previous step
202203
gsync_del(production_workflow_bucket, production_workflow_version_bucket, args.workflow_name, dry_run)
204+
205+
if dry_run:
206+
logging.info(f"Would copy {uat_workflow_metadata_path} to {production_workflow_metadata_path}")
207+
else:
208+
# Promote combined manifest and data promotion report from staging to production
209+
gcopy(uat_workflow_metadata_path, production_workflow_metadata_path, recursive=True)
203210
else:
204211
logging.error(f"Data cannot be promoted for [{team}-{args.source}-{dataset}]; exiting")
205212
sys.exit(1)

0 commit comments

Comments
 (0)