I am using the job tracker to launch multiple jobs, but only a few can run concurrently or I start getting call depth overflow errors.
Is it possible to queue jobs or launch jobs, but throttle them based upon a job count value? All while keeping the gui responsive of course. I can easily do it within the main form, but of course then the form freezes in the 'while' loop.
Rob
Job tracker - throtting jobs
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- robert.ganshorn
- Posts: 54
- Last visit: Sat Nov 25, 2023 8:17 pm
Re: Job tracker - throtting jobs
On a side note, I resolved this by creating temporary .job files for each job as they are launched. To keep started jobs from all running at the exact same time, there is a small random delay period in the startup of each job to stagger their start. The .job files are used to keep track of the jobs running and are removed as they complete. Each job count the .job files and loop when there are 4 or more. Maybe it's not the most elegant solution, but it works and isn't too convoluted. .job files are named after the job in question (ie: job1.job, job2.job etc).
Rob
Rob
- robert.ganshorn
- Posts: 54
- Last visit: Sat Nov 25, 2023 8:17 pm
Re: Job tracker - throtting jobs
I don't have an example.
Look into System.Collections.Generic.Queue
Look into System.Collections.Generic.Queue
- apowershelluser
- Posts: 194
- Last visit: Fri Mar 22, 2024 4:38 am
Re: Job tracker - throtting jobs
I was hoping the same
I have a job that runs, 90% completes very quickly and displays and we have to wait another 10 seconds for the last job to finish
I have a job that runs, 90% completes very quickly and displays and we have to wait another 10 seconds for the last job to finish
Re: Job tracker - throtting jobs
Also consider using a workflow as it can execute a number of items in parallel and execute new items as threads become available.
With a workflow you can set the concurrency and max pool size. The workflow then handles all queuing of tasks.
With a workflow you can set the concurrency and max pool size. The workflow then handles all queuing of tasks.