code: def wait(self, seconds, poll_interval):
          
          # jid is None when all hosts were skipped
          if self.jid is None:
              return self.results
  
          clock = seconds - poll_interval
          while (clock >= 0 and not self.completed):
              time.sleep(poll_interval)
  
              poll_results = self.poll()
  
              for (host, res) in poll_results['polled'].iteritems():
                  if res.get('started'):
                      self.runner.callbacks.on_async_poll(host, res, self.jid, clock)
  
              clock = clock - poll_interval
  
          return self.results
docs: Wait a certain time for job completion, check status every poll_interval.