From 06b7f0874586f2cef12966919846dc9fad8573a8 Mon Sep 17 00:00:00 2001 From: nlarge-google Date: Wed, 6 Nov 2024 19:23:12 +0000 Subject: [PATCH] Fix: Resolve coding error on check if file exists. --- .../_images/run_csv_transform_kub/csv_transform.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datasets/nlm_rxnorm/pipelines/_images/run_csv_transform_kub/csv_transform.py b/datasets/nlm_rxnorm/pipelines/_images/run_csv_transform_kub/csv_transform.py index 911171751..0eee7d413 100644 --- a/datasets/nlm_rxnorm/pipelines/_images/run_csv_transform_kub/csv_transform.py +++ b/datasets/nlm_rxnorm/pipelines/_images/run_csv_transform_kub/csv_transform.py @@ -133,7 +133,7 @@ def load_process_filegroup_data( ) zip_file = zip_file_list[0] if zip_file_list else "" if zip_file != "": - if os.path.isfile(zip_file): + if fetch_gcs_file_names(target_gcs_bucket, zip_file): source_location_gcs = os.path.join("gs://", target_gcs_bucket, zip_file) download_file_gcs( project_id=project_id, @@ -154,6 +154,8 @@ def load_process_filegroup_data( target_file=os.path.join(zip_path, os.path.basename(zip_file)), target_gcs_bucket=target_gcs_bucket, ) + else: + raise(f"File gs://{target_gcs_bucket}/{zip_file} does not exist. Cannot continue.") else: # zip file does not exist logging.info( @@ -219,7 +221,7 @@ def load_source_data( project_id=project_id, dataset_id=dataset_id, table_id=table_id, - schema_filepath=schema_filepath, + schema_filepath=f"{schema_filepath}/{str.lower(process_filegroup)}_schema.json", bucket_name=target_gcs_bucket, ) if table_exists: