Skip to content

Commit 1e09126

Browse files
committed
gaarf-wf: [CF getcids] decreased the default number of accounts in batch
gaarf-wf: [Workflow] added timeout for calling workflow-ads (24 hours instead of the default one of 30 mins) gaarf-wf: [Workflow] fixed argument encoding for Scheduler Job (used by schedule-wf.sh) gaarf-wf: [CF gaarf] forgotten compiled code for gaarf CF (logging refactored) Change-Id: I8e4be0c05c51f39d50485500a2c857ddda0956ba
1 parent ad341d2 commit 1e09126

File tree

7 files changed

+33
-22
lines changed

7 files changed

+33
-22
lines changed

gcp/functions/build/src/gaarf-getcids.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/functions/build/src/gaarf-getcids.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/functions/build/src/gaarf.js

Lines changed: 17 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/functions/build/src/gaarf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gcp/functions/src/gaarf-getcids.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import express from 'express';
2525
import {getAdsConfig, getProject, splitIntoChunks} from './utils';
2626
import {createLogger, ILogger} from './logger';
2727

28-
const DEFAULT_BATCH_SIZE = 1_000;
28+
const DEFAULT_BATCH_SIZE = 500;
2929

3030
async function main_getcids_unsafe(
3131
req: express.Request,
@@ -67,21 +67,24 @@ async function main_getcids_unsafe(
6767
customerIds,
6868
customer_ids_query
6969
);
70+
await logger.info(
71+
`Loaded ${customerIds.length} accounts`
72+
);
7073
}
7174
customerIds = customerIds || [];
7275
customerIds.sort();
7376

7477
// now we have a final list of accounts (customerIds)
7578
let batchSize = DEFAULT_BATCH_SIZE;
7679
if (req.query.customer_ids_batchsize) {
77-
batchSize = parseInt(<string>req.query.customer_ids_batchsize);
80+
batchSize = Number(<string>req.query.customer_ids_batchsize);
7881
if (isNaN(batchSize)) {
7982
throw new Error('customer_ids_batchsize should be a number');
8083
}
8184
}
8285
if (req.query.customer_ids_offset) {
8386
// extract a subset of CIDs if offset is specified
84-
const offset = parseInt(<string>req.query.customer_ids_offset);
87+
const offset = Number(<string>req.query.customer_ids_offset);
8588
if (isNaN(offset)) {
8689
throw new Error('customer_ids_offset should be a number');
8790
}

gcp/setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ schedule_wf() {
140140
SCHEDULE_TZ=$(git config -f $SETTING_FILE scheduler.schedule-timezone|| echo "Etc/UTC")
141141

142142
data=$(_get_data $@)
143+
escaped_data="$(echo "$data" | sed 's/"/\\"/g')"
143144

144145
JOB_EXISTS=$(gcloud scheduler jobs list --location=$REGION --format="value(ID)" --filter="ID:'$JOB_NAME'")
145146
if [[ -n $JOB_EXISTS ]]; then
@@ -150,7 +151,7 @@ schedule_wf() {
150151
gcloud scheduler jobs create http $JOB_NAME \
151152
--schedule="$SCHEDULE" \
152153
--uri="https://workflowexecutions.googleapis.com/v1/projects/$PROJECT_ID/locations/$REGION/workflows/$WORKFLOW_NAME/executions" --location=$REGION \
153-
--message-body="{\"argument\": \"$data\"}" \
154+
--message-body="{\"argument\": \"$escaped_data\"}" \
154155
--oauth-service-account-email="$SERVICE_ACCOUNT" \
155156
--time-zone="$SCHEDULE_TZ"
156157
}

0 commit comments

Comments
 (0)