-
Notifications
You must be signed in to change notification settings - Fork 301
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
Parallelise artifact collection #2456
Conversation
3d7ab00
to
274b1b5
Compare
Very interested in giving it a try! |
274b1b5
to
f858cd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. happy to see us getting more chan
-y with it, for a go project, the agent has surprisingly few goroutines.
agent/artifact_uploader.go
Outdated
|
||
// Start N workers in a new context | ||
wctx, cancel := context.WithCancelCause(ctx) | ||
for i := 0; i < runtime.NumCPU(); i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is runtime.NumCPU()
being used here as "an arbitrary smallish number to parallelise by, which will be roughly proportional to the size of the box we're running on"? that's a totally valid use case, i just wanna be sure i'm reading right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's not a great heuristic though. We could create N goroutines and let the runtime figure it out. The code would be simpler, and unlike a server, the amount of work is fixed ahead of time, so it's not unreasonable. Actually, that idea is growing on me...
d191162
to
cf5edf7
Compare
cf5edf7
to
333e16d
Compare
It's possible to configure
Paths
with a lot of separate globs. It's not unreasonable that each of these could be of the form**/something
, and each one requires walking the entire directory tree.go-zglob
is not terribly slow because it uses a parallel walker under the hood (fastwalk
). While I think about how to speed upzzglob
, this is a reasonable first step.This also fixes a bug where
wd
is replaced with"/"
(orfilepath.VolumeName(absolutePath) + "/"
on Windows) on the first glob path in the list that is is absolute, changingwd
for later glob paths that might not be absolute.