Skip to content
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

1 pool for 3 different tasks with the same number of workers on each task #51

Open
vodves-vodves opened this issue Oct 23, 2023 · 1 comment

Comments

@vodves-vodves
Copy link

I'm a bit confused how I can make it so that I create 1 pool where I make submissions to 3 different tasks, but still have the same number of workers for each task

Example:

pool := pond.New(40, 0, pond.MinWorkers(40)) // 40 workers on each task

pool.Submit(func() {
      //task 1 with 40 workers
})

pool.Submit(func() {
      //task 2 with 40 workers
})

pool.Submit(func() {
      //task 3 with 40 workers
})

pool.StopAndWait()
@asing1
Copy link

asing1 commented Dec 20, 2023

You should create a group of pool and then submit the task

Example:

pool := pond.New(40, 0, pond.MinWorkers(40)) // 40 workers on each task
pGroup := pool.Group()

pGroup.Submit(func() {
      //task 1 with 40 workers
})

pGroup.Submit(func() {
      //task 2 with 40 workers
})

pGroup.Submit(func() {
      //task 3 with 40 workers
})

pool.StopAndWait()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants