Skip to content

Commit

Permalink
[[email protected]] support passing bq-writer options via answers…
Browse files Browse the repository at this point in the history
… file

[gaarf-wf] Fixed: fixed bug introduced on 27.07 (Workflow: broader check for http error of repeatable errors) - comparing error code can fail if it's null ("TypeError: unsupported operand types for >=: 'null' and 'int' (expecting numbers)")

Change-Id: I9ad6f066b5de630a2cd7804c40b500cd7fb66773
  • Loading branch information
evil-shrike committed Sep 1, 2023
1 parent b16d0e0 commit 1388c00
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion gcp/create-gaarf-wf/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gcp/create-gaarf-wf/build/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions gcp/create-gaarf-wf/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gcp/create-gaarf-wf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-gaarf-wf",
"version": "1.7.0",
"version": "1.8.0",
"description": "Interactive generator for Gaarf (Google Ads API Report Fetcher) Workflow",
"type": "module",
"bin": {
Expand Down
5 changes: 3 additions & 2 deletions gcp/create-gaarf-wf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -989,11 +989,11 @@ cd ../workflow
answers,
'bq_macro'
);

const bq_writer_options = answers.bq_writer_options;
const bq_location =
gcp_region && gcp_region.startsWith('europe') ? 'europe' : '';
const output_dataset = answers2.output_dataset;
const customer_id = answers2.customer_id.toString().replaceAll("-", "");
const customer_id = answers2.customer_id.toString().replaceAll('-', '');
const wf_data = {
cloud_function: name,
gcs_bucket: gcs_bucket,
Expand All @@ -1005,6 +1005,7 @@ cd ../workflow
ads_config_path: `${gcs_base_path}/google-ads.yaml`,
customer_ids_query: custom_query_gcs_path,
bq_dataset_location: bq_location,
bq_writer_options: bq_writer_options,
ads_macro: macro_ads,
bq_macro: macro_bq,
bq_sql: {},
Expand Down
2 changes: 1 addition & 1 deletion gcp/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@google-cloud/functions-framework": "^3.1.2",
"@google-cloud/logging": "^10.4.0",
"@google-cloud/logging-winston": "^5.3.0",
"google-ads-api-report-fetcher": "^2.1.0",
"google-ads-api-report-fetcher": "^2.2.0",
"google-auth-library": "^8.7.0",
"js-yaml": "^4.1.0"
},
Expand Down
5 changes: 3 additions & 2 deletions gcp/workflow/workflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,10 @@ custom_retry_predicate:
severity: "WARNING"
- what_to_repeat:
switch:
# NOTE: sometime errors happen inside Workflow and there's no any code
# NOTE: sometime errors happen inside Workflow and there's no any code
# (i.e. "code" is null, so DO NOT user operand <,>,>=,<=, or otherwise that check will fail with error TypeError: unsupported operand types for >=: 'null' and 'int' (expecting numbers))
# We'll repeat if it's a ConnectionError, TimeoutError, Internal Server Error (500) or Too Many Requests (429)
- condition: ${"ConnectionError" in default(map.get(e, "tags"), []) or "TimeoutError" in default(map.get(e, "tags"), []) or map.get(e, "code") >= 500 or map.get(e, "code") == 429}
- condition: ${"ConnectionError" in default(map.get(e, "tags"), []) or "TimeoutError" in default(map.get(e, "tags"), []) or default(map.get(e, "code"), 0) >= 500 or map.get(e, "code") == 429}
return: true
- otherwise:
return: false
2 changes: 1 addition & 1 deletion js/dist/lib/bq-writer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/lib/bq-writer.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src/lib/bq-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export class BigQueryWriter implements IResultWriter {
`An error occured during creating the unified view (${table_fq}): ${e.message}`
);
if (e.message.includes("Views cannot be queried through prefix")) {
this.logger.warn(`You have to rename the script ${this.tableId} to a name so the wildcard expression ${this.tableId}_* would catch other views `);
this.logger.warn(`You have to rename the script ${this.tableId} to a name so the wildcard expression ${this.tableId}_* would not catch other views`);
}
throw e;
}
Expand Down

0 comments on commit 1388c00

Please sign in to comment.