Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit d3e5659

Browse files
authored
fix batch replayer parameters (#500)
* update BatchReplayer sinkObjectKey parameter to reflect it's default value when it's not set
1 parent ebe9313 commit d3e5659

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

core/src/data-generator/batch-replayer.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class BatchReplayer extends Construct {
120120
this.dataset = props.dataset;
121121
this.frequency = props.frequency?.toSeconds() || 60;
122122
this.sinkBucket = props.sinkBucket;
123-
this.sinkObjectKey = props.sinkObjectKey;
123+
this.sinkObjectKey = this.sinkObjectKey ? `${this.sinkObjectKey}/${this.dataset.tableName}` : this.dataset.tableName;
124124
this.outputFileMaxSizeInBytes = props.outputFileMaxSizeInBytes || 100 * 1024 * 1024; //Default to 100 MB
125125

126126
const dataWranglerLayer = LayerVersion.fromLayerVersionArn(this, 'PandasLayer', `arn:aws:lambda:${Aws.REGION}:336392948345:layer:AWSDataWrangler-Python39:1`);
@@ -200,10 +200,8 @@ export class BatchReplayer extends Construct {
200200
});
201201

202202
// grant permissions to write to the bucket and to use the KMS key
203-
const putPattern = this.sinkObjectKey ? `${this.sinkObjectKey}/*` : undefined;
204-
this.sinkBucket.grantWrite(writeInBatchFn, putPattern);
203+
this.sinkBucket.grantWrite(writeInBatchFn, `${this.sinkObjectKey}/*`);
205204

206-
const sinkPath = this.sinkObjectKey ? `${this.sinkObjectKey}/${this.dataset.tableName}` : this.dataset.tableName;
207205
const writeInBatchFnTask = new LambdaInvoke(this, 'WriteInBatchFnTask', {
208206
lambdaFunction: writeInBatchFn,
209207
payload: TaskInput.fromObject({
@@ -219,7 +217,7 @@ export class BatchReplayer extends Construct {
219217
// For file processing
220218
dateTimeColumnToFilter: this.dataset.dateTimeColumnToFilter,
221219
dateTimeColumnsToAdjust: this.dataset.dateTimeColumnsToAdjust,
222-
sinkPath: this.sinkBucket.s3UrlForObject(sinkPath),
220+
sinkPath: this.sinkBucket.s3UrlForObject(this.sinkObjectKey),
223221
outputFileMaxSizeInBytes: 20480,
224222
}),
225223
// Retry on 500 error on invocation with an interval of 2 sec with back-off rate 2, for 6 times

0 commit comments

Comments
 (0)