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

Clarify Wait-RSJob documentation on -Timeout parameter #58

Closed
nfields03 opened this issue Jan 19, 2016 · 6 comments
Closed

Clarify Wait-RSJob documentation on -Timeout parameter #58

nfields03 opened this issue Jan 19, 2016 · 6 comments
Assignees
Milestone

Comments

@nfields03
Copy link

I'm probably being a bit pedantic, but as a point of documentation it may be worth clarifying the nature of the timeout parameter in the Wait-RSJob function a little more in the context of job throttling. If I've got a process that needs to touch 8000 computers, but I throttle the jobs so that only 20 run a time, was the Wait-RSJob on a per job basis or one timeout globally? From some testing on about 200 computers it seems to be a global countdown but I wasn't sure.

@proxb proxb self-assigned this Jan 20, 2016
@proxb
Copy link
Owner

proxb commented Jan 20, 2016

Thanks for the comment. I can look to tidy up on how -Timeout works in the function. The point of timeout within Wait-RSJob is only to be a blocking call up until either the timeout is reached or all of the jobs are marked as Completed. If the timeout is reached, then it only frees up the console for further use while the rest of the jobs are still running until they complete.

@nfields03
Copy link
Author

Okay, my use case was one similar to another discussion posted here in that the job that touches those workstations makes WMI calls and there are a handful of systems out of that population that have a tendency to hang causing the job to never complete. Given that scenario and your explanation, I'm probably thinking of still using the throttle switch on start-rsjob, but not piping that to wait-rsjob but instead having wait-rsjob with the timeout on it's own line, e.g.

$AllWorkstations | Start-RSJob -Name 'Inventory' -ScriptBlock $ScriptBlock -FunctionsToLoad Get-Warranty -Throttle 20

Wait-RSJob -ShowProgress -Timeout 60

$Results = Get-RSJob | Receive-RSJob

Something like that?

@proxb
Copy link
Owner

proxb commented Feb 2, 2016

I'm going to look more into adding a -Timeout parameter with Start-RSJob that would timeout commands. In the mean time, you can achieve a timeout using the Wait-RSJob and then stopping the rest of the jobs by using something like this:

Get-RSJob -State Running | Stop-RSJob

Keep in mind that using Wait-RSJob called by itself will not do anything; you must use Get-RSJob | Wait-RSJob in order to actually force a blocking call in the console while waiting for the jobs.

@nfields03
Copy link
Author

Sounds good Boe, I was able to modify my script as you suggested. The
module is awesome BTW!

Cheers,

Nick

On Tue, Feb 2, 2016 at 4:30 PM, Boe Prox notifications@github.com wrote:

I'm going to look more into adding a -Timeout parameter with Start-RSJob
that would timeout commands. In the mean time, you can achieve a timeout
using the Wait-RSJob and then stopping the rest of the jobs by using
something like this:

Get-RSJob -State Running | Stop-RSJob

Keep in mind that using Wait-RSJob called by itself will not do anything;
you must use Get-RSJob | Wait-RSJob in order to actually force a blocking
call in the console while waiting for the jobs.


Reply to this email directly or view it on GitHub
#58 (comment).

@proxb proxb modified the milestones: 1.5.6.2, 1.5.6.3 Apr 8, 2016
@proxb proxb added the Ready label Apr 8, 2016
@proxb
Copy link
Owner

proxb commented Apr 9, 2016

Documentation updated to better reflect its purpose.

@proxb proxb closed this as completed Apr 9, 2016
@mkruchten
Copy link

Has a -Timeout parameter been added as mention on Feb 2 2016? I have a similar situation both with WMI calls and connections to MS SQL Server where the connection just hangs, and it would be really useful to solve this. I've been kicking around trying to use a synchronized hashtable like mentioned here, but I'm not quite fluent enough (yet) in Powershell.

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

No branches or pull requests

3 participants