Skip to content

Commit

Permalink
Remove defaults for batch-max-* pipeline parameters and define valu…
Browse files Browse the repository at this point in the history
…e ranges (#7576)

* Update help message for `batch-max-*` pipeline parameters

Closes https://jira.cfdata.org/browse/PIPE-152

The defaults are currently in flux and changing as we determine
what makes sense for the system. To support these changing values,
remove the defaults from the client as they will be set by the API.
The values used to create the pipeline are visible to user when doing
`wrangler pipeline show <name>`.

Create three-chefs-bathe.md

* Covert MB to bytes for the API
  • Loading branch information
cmackenzie1 authored Jan 8, 2025
1 parent 17c2cdd commit 773bda8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-chefs-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Remove defaults for `batch-max-*` pipeline parameters and define value ranges
9 changes: 3 additions & 6 deletions packages/wrangler/src/__tests__/pipelines.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,9 @@ describe("pipelines", () => {
OPTIONS
--secret-access-key The R2 service token Access Key to write data [string]
--access-key-id The R2 service token Secret Key to write data [string]
--batch-max-mb The approximate maximum size of a batch before flush in megabytes
Default: 10 [number]
--batch-max-rows The approximate maximum size of a batch before flush in rows
Default: 10000 [number]
--batch-max-seconds The approximate maximum duration of a batch before flush in seconds
Default: 15 [number]
--batch-max-mb The approximate maximum size (in megabytes) for each batch before flushing (range: 1 - 100) [number]
--batch-max-rows The approximate maximum number of rows in a batch before flushing (range: 100 - 1000000) [number]
--batch-max-seconds The approximate maximum age (in seconds) of a batch before flushing (range: 1 - 300) [number]
--transform The worker and entrypoint of the PipelineTransform implementation in the format \\"worker.entrypoint\\"
Default: No transformation worker [string]
--compression Sets the compression format of output files
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/pipelines/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type PipelineUserConfig = {
};
batch: {
max_duration_s?: number;
max_mb?: number;
max_bytes?: number;
max_rows?: number;
};
path: {
Expand Down
13 changes: 8 additions & 5 deletions packages/wrangler/src/pipelines/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ function addCreateAndUpdateOptions(yargs: Argv<CommonYargsOptions>) {
})
.option("batch-max-mb", {
describe:
"The approximate maximum size of a batch before flush in megabytes \nDefault: 10",
"The approximate maximum size (in megabytes) for each batch before flushing (range: 1 - 100)",
type: "number",
demandOption: false,
})
.option("batch-max-rows", {
describe:
"The approximate maximum size of a batch before flush in rows \nDefault: 10000",
"The approximate maximum number of rows in a batch before flushing (range: 100 - 1000000)",
type: "number",
demandOption: false,
})
.option("batch-max-seconds", {
describe:
"The approximate maximum duration of a batch before flush in seconds \nDefault: 15",
"The approximate maximum age (in seconds) of a batch before flushing (range: 1 - 300)",
type: "number",
demandOption: false,
})
Expand Down Expand Up @@ -196,7 +196,9 @@ export function pipelines(pipelineYargs: CommonYargsArgv) {
args.compression === undefined ? "gzip" : args.compression;

const batch = {
max_mb: args["batch-max-mb"],
max_bytes: args["batch-max-mb"]
? args["batch-max-mb"] * 1000 * 1000 // convert to bytes for the API
: undefined,
max_duration_s: args["batch-max-seconds"],
max_rows: args["batch-max-rows"],
};
Expand Down Expand Up @@ -386,7 +388,8 @@ export function pipelines(pipelineYargs: CommonYargsArgv) {
pipelineConfig.destination.compression.type = args.compression;
}
if (args["batch-max-mb"]) {
pipelineConfig.destination.batch.max_mb = args["batch-max-mb"];
pipelineConfig.destination.batch.max_bytes =
args["batch-max-mb"] * 1000 * 1000; // convert to bytes for the API
}
if (args["batch-max-seconds"]) {
pipelineConfig.destination.batch.max_duration_s =
Expand Down

0 comments on commit 773bda8

Please sign in to comment.