'Wait for all open spot requests for this cluster to transition to
\'active\'.'

def wait_for_active_spots(self, spots=None):

    spots = (spots or self.spot_requests)
    open_spots = [spot for spot in spots if (spot.state == 'open')]
    if open_spots:
        pbar = self.progress_bar.reset()
        log.info('Waiting    for    open    spot    requests    to    become    active...')
        pbar.maxval = len(spots)
        pbar.update(0)
        while (not pbar.finished):
            active_spots = [s for s in spots if ((s.state == 'active') and s.instance_id)]
            pbar.maxval = len(spots)
            pbar.update(len(active_spots))
            if (not pbar.finished):
                time.sleep(self.refresh_interval)
                spots = self.get_spot_requests_or_raise()
        pbar.reset()
    self.ec2.wait_for_propagation(instances=[s.instance_id for s in spots])
