Skip to content

Commit

Permalink
Merge pull request #27 from chef/ma/poll_less
Browse files Browse the repository at this point in the history
Make the polling rate configurable for job status
  • Loading branch information
markan committed Jun 17, 2015
2 parents d93c61d + 356622e commit 5256a6d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/chef/knife/job_start.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class JobStart < Chef::Knife
:default => false,
:description => "Rather than waiting for each job to complete, exit immediately after starting the job."

option :poll_interval,
:long => '--poll-interval RATE',
:default => 1.0,
:description => "Repeat interval for job status update (in seconds)."

def run
@node_names = []

Expand Down Expand Up @@ -95,7 +100,8 @@ def run
exit(0) if config[:nowait]
previous_state = "Initialized."
begin
sleep(0.1)
sleep(config[:poll_interval].to_f)
putc(".")
job = rest.get_rest(job_uri)
finished, state = status_string(job)
if state != previous_state
Expand Down

0 comments on commit 5256a6d

Please sign in to comment.