Pode icon indicating copy to clipboard operation
Pode copied to clipboard

A new Test-PodeTaskInvoked function

Open Badgerati opened this issue 2 years ago • 1 comments

Test if some task is currently being invoked/running - by checking all currently running task processes with that task’s name.

Possibly also add a Wait function as well, to wait for the task to no longer have any invoked processes?

# check if TaskA has any invoked processes
Test-PodeTaskInvoked -Name TaskA

# wait for TaskA to be idle(?) and have no invoked processes
Wait-PodeTaskIdle? -Name TaskA

# when TaskB is invoked, it will automatically wait for any TaskA processes to complete
New-PodeTask -Name TaskB -WaitOn TaskA

# TaskC here could be sequential, in which case only one can run at a time?
New-PodeTask -Name TaskC -Type [Parallel | Sequential]

Update Get-PodeTask, or just the Task object, to have a ProcessCount or Processes array? One is just a count of current invoked processes and the other an array of invoked process names.

Or: Get-PodeTaskProcesses

Could we differentiate between a Queued process, and an Active one? Like a Queued one is one just created, but an Active one is one now running in the runspace?

Badgerati avatar Nov 29 '22 21:11 Badgerati

Another function I thought was in the list above:

  • Get-PodeTaskProcess - this will return an invoked task process object, similar to the object returned by Invoke-PodeTask

Badgerati avatar Mar 11 '24 22:03 Badgerati