-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Feature: task level isolation #62
Comments
I envisioned something like await runIsolated()
for (const env of envs) {
await pool.flushWorkers()
await runSingleThread()
} If we are looking into options.isolationKey = 'all'
await runIsolated()
for (const env of envs) {
options.isolationKey = env
await runSingleThread()
} |
or a filter function argument, that analyzes the arguments passed to the run method and returns a key (any string), and based on that string, starts grouping workers. filter: (options) => {
if (options.env === 'node') {
return 'node' // workers with env=node will be in their own isolation
} else {
return 'else' // others will be in another isolation.
}
} |
This is also good idea but I think it has some design pitfalls as well. Mostly caused by the fact that workers are created before I'll start by looking into |
Vitest will need "task level" worker isolation for following features and fixes:
Naming things is hard, but by "task level isolation" I mean a situation where pool's
isolateWorkers
can be set asfalse
, but then pool itself can be instructed to use fresh new workers for tasks on demand. There are situations where we may not need isolation at all, but based on dynamic variables on runtime we'll suddenly need to recycle workers for next tasks.Or maybe a
isolationKey
which would be used to see if given tasks can share the worker:Some pitfalls to consider:
pool.flushWorkers
instruct those ones to terminate once they have resolved?options.environment
changes we only want to recycle the existing threads and not the new ones. Here therunInNewWorker
would keep recycling all new threads which would be slow.isolationKey
might be easiest to implement and handleLet's start by looking into
pool.flushWorkers()
.The text was updated successfully, but these errors were encountered: