这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix parsing concurrency as a number or percent #1371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 13, 2022

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Jun 10, 2022

Fixes #1336

Implemented a custom value to accept either a number or percentage.

@vercel
Copy link

vercel bot commented Jun 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
turbo-site ⬜️ Ignored (Inspect) Jun 13, 2022 at 4:25PM (UTC)

@gsoltis
Copy link
Contributor Author

gsoltis commented Jun 10, 2022

Also fixes an invalid memory access when rendering the usage text for --output-logs.

@gsoltis gsoltis marked this pull request as ready for review June 10, 2022 18:17
@nathanhammond nathanhammond added the pr: fixship A PR which is approved with notes and does not require re-review. label Jun 13, 2022
Copy link
Contributor

@nathanhammond nathanhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing intended to block is the typo in code you didn't touch and adding a few more edge case tests.

Any percentage value as default concurrency is also better than "10" so I don't have strong opinions about what it should be, but I see "10" as wrong (we're always shelling out, so it's not goroutine vs. threads; they're all threads underneath the hood).

flags.AddFlag(&pflag.Flag{
Name: "concurrency",
Usage: "Limit the concurrency of task execution. Use 1 for serial (i.e. one-at-a-time) execution.",
DefValue: "10",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to make this 50% or 100%... 10 is such an arbitrary number and has totally different outcomes on CI vs. local dev boxes.

},
cacheOpts: cache.Opts{
Dir: defaultCacheFolder,
Workers: 10,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relatedly, we don't even give you a choice here, which should probably be mapped to the same calculated concurrency value:

Workers: runtime.NumCPU() + 2,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, we should wire it up at some point. It also probably should not live in a top-level config, since it's not relevant to every command.

@@ -389,3 +408,26 @@ func Test_taskSelfRef(t *testing.T) {
t.Fatalf("expected to failed to build task graph: %v", err)
}
}

func TestUsageText(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching and testing this. ❤️

@gsoltis gsoltis force-pushed the gsoltis/fix_concurrency_percentage branch from 696088c to d2d16d7 Compare June 13, 2022 16:24
@gsoltis gsoltis added pr: automerge Kodiak will merge these automatically after checks pass and removed pr: fixship A PR which is approved with notes and does not require re-review. labels Jun 13, 2022
@nathanhammond nathanhammond added pr: on hold Pull requests that are "on hold" and should not be merged and removed pr: on hold Pull requests that are "on hold" and should not be merged labels Jun 13, 2022
@kodiakhq kodiakhq bot merged commit 714aa1d into main Jun 13, 2022
@kodiakhq kodiakhq bot deleted the gsoltis/fix_concurrency_percentage branch June 13, 2022 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "--concurrency" option of the "turbo run" command cannot be specified as a percentage
2 participants