8000 Jobs dynamically change AllocatedRunspaceCount · Issue #25539 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Jobs dynamically change AllocatedRunspaceCount #25539
Open
@agowa

Description

@agowa

Summary of the new feature / enhancement

For better adaption to dynamic load it would be great if jobs could be dynamically updated with the amount of parallel childjobs it processes.

Such a feature is especially desirable when the limit in question does not arise from local resources like cpu, or memory but from something remote and where an API as it is way more difficult to impossible to get a good limit without dialing it in (aka slowly increasing the load)

E.g. all jobs get scheduled via: $bgJobs = ... | ForEach-Object -ThrottleLimit 32 -AsJob -Parallel {Do-Some -LongRunningBackgroundJob}. Then something at runtime happens and the limit needs to be updated (or alternatively simply because the system is either under or over utilized by this task).

Proposed technical implementation details (optional)

Add an "UpdateThrottleLimit" method to System.Management.Automation.PSTasks.PSTaskJob that when called will influence how many pending jobs get scheduled moving forward $bgJobs.UpdateThrottleLimit(20).
Or the AllocatedRunspaceCount property is extended with an additional setter $bgJobs.AllocatedRunspaceCount = 20

E.g. there are 2000 jobs in the queue the current limit is 32 and therefore 32 are currently running. When the limit is lowered ($bgJobs.UpdateThrottleLimit(5)) no additional job is started until the number of currently running jobs falls below it. If the limit is increased ($bgJobs.UpdateThrottleLimit(64)) additional child jobs are started until it is reached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0