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
3 changes: 1 addition & 2 deletions pipeline/workflow/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ substitutions:
_AR_REPO_URL: 'us-docker.pkg.dev/datcom-ci/gcr.io'
_BQ_SPANNER_CONN_ID: 'projects/datcom-ci/locations/us-central1/connections/bq_spanner_conn_test'
_VERSION: '${SHORT_SHA}'
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/ingestion-${_VERSION}.json'
_PROD_TAG: 'stable'

steps:
Expand Down Expand Up @@ -65,7 +64,7 @@ steps:
- '.'
- '--config=deploy-services.yaml'
- '--project=${_PROJECT_ID}'
- '--substitutions=_PROJECT_ID=${_PROJECT_ID},_SPANNER_PROJECT_ID=${_SPANNER_PROJECT_ID},_SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID},_SPANNER_DATABASE_ID=${_SPANNER_DATABASE_ID},_SPANNER_GRAPH_DATABASE_ID=${_SPANNER_GRAPH_DATABASE_ID},_GCS_BUCKET_ID=${_GCS_BUCKET_ID},_LOCATION=${_LOCATION},_GCS_MOUNT_BUCKET=${_GCS_MOUNT_BUCKET},_BQ_DATASET_ID=${_BQ_DATASET_ID},_PROJECT_NUMBER=${_PROJECT_NUMBER},_BQ_SPANNER_CONN_ID=${_BQ_SPANNER_CONN_ID},_VERSION=${_VERSION},_DATAFLOW_TEMPLATE_PATH=${_DATAFLOW_TEMPLATE_PATH}'
- '--substitutions=_PROJECT_ID=${_PROJECT_ID},_SPANNER_PROJECT_ID=${_SPANNER_PROJECT_ID},_SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID},_SPANNER_DATABASE_ID=${_SPANNER_DATABASE_ID},_SPANNER_GRAPH_DATABASE_ID=${_SPANNER_GRAPH_DATABASE_ID},_GCS_BUCKET_ID=${_GCS_BUCKET_ID},_LOCATION=${_LOCATION},_GCS_MOUNT_BUCKET=${_GCS_MOUNT_BUCKET},_BQ_DATASET_ID=${_BQ_DATASET_ID},_PROJECT_NUMBER=${_PROJECT_NUMBER},_BQ_SPANNER_CONN_ID=${_BQ_SPANNER_CONN_ID},_VERSION=${_VERSION}'
dir: 'pipeline/workflow'

# 2. Run E2E Tests on Staging
Expand Down
4 changes: 2 additions & 2 deletions pipeline/workflow/deploy-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ substitutions:
_AR_REPO_URL: 'us-docker.pkg.dev/datcom-ci/gcr.io'
_BQ_SPANNER_CONN_ID: 'projects/datcom-import-automation-prod/locations/us/connections/bq_spanner_conn'
_VERSION: '${SHORT_SHA}'
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/ingestion-${_VERSION}.json'
_DATAFLOW_TEMPLATE_PATH: 'gs://datcom-templates/templates/flex/'

steps:
- id: 'ingestion-helper-service'
Expand All @@ -47,7 +47,7 @@ steps:

- id: 'spanner-ingestion-workflow'
name: 'gcr.io/cloud-builders/gcloud'
args: ['workflows', 'deploy', 'spanner-ingestion-workflow', '--project', '${_PROJECT_ID}', '--location', '${_LOCATION}', '--source', 'spanner-ingestion-workflow.yaml', '--set-env-vars', 'LOCATION=${_LOCATION},PROJECT_ID=${_PROJECT_ID},SPANNER_PROJECT_ID=${_SPANNER_PROJECT_ID},SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID},SPANNER_DATABASE_ID=${_SPANNER_GRAPH_DATABASE_ID},PROJECT_NUMBER=${_PROJECT_NUMBER},DATAFLOW_TEMPLATE_PATH=${_DATAFLOW_TEMPLATE_PATH}']
args: ['workflows', 'deploy', 'spanner-ingestion-workflow', '--project', '${_PROJECT_ID}', '--location', '${_LOCATION}', '--source', 'spanner-ingestion-workflow.yaml', '--set-env-vars', 'LOCATION=${_LOCATION},PROJECT_ID=${_PROJECT_ID},SPANNER_PROJECT_ID=${_SPANNER_PROJECT_ID},SPANNER_INSTANCE_ID=${_SPANNER_INSTANCE_ID},SPANNER_DATABASE_ID=${_SPANNER_GRAPH_DATABASE_ID},PROJECT_NUMBER=${_PROJECT_NUMBER},DATAFLOW_TEMPLATE_PATH=${_DATAFLOW_TEMPLATE_PATH}ingestion-${_VERSION}.json']

options:
logging: CLOUD_LOGGING_ONLY
6 changes: 5 additions & 1 deletion pipeline/workflow/ingestion-helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ def ingestion_helper(request):
# Input:
# importList: list of imports to aggregate
import_list = request_json.get('importList', [])
if not import_list:
logging.info("Empty import list. Skipping aggregation.")
return jsonify({'status': 'SUBMITTED', 'jobIds': []}), 200

# Validate required flags are not empty or None
missing_flags = []
Expand Down Expand Up @@ -312,7 +315,8 @@ def ingestion_helper(request):
# jobIds: list of BigQuery job IDs
job_ids = request_json.get('jobIds', [])
if not job_ids:
return ('Missing or empty jobIds', 400)
logging.info("Empty jobIds. Returning status DONE.")
return jsonify({'status': 'DONE'}), 200

aggregation = AggregationUtils(
connection_id=FLAGS.spanner_connection_id,
Expand Down