'Restarts containers via the scheduler'

def _restart_containers(self, to_restart):

    if (not to_restart):
        return
    stop_threads = [Thread(target=c.stop) for c in to_restart]
    start_threads = [Thread(target=c.start) for c in to_restart]
    [t.start() for t in stop_threads]
    [t.join() for t in stop_threads]
    if any(((c.state != u'created') for c in to_restart)):
        err = u'warning,    some    containers    failed    to    stop'
        log_event(self, err, logging.WARNING)
    [t.start() for t in start_threads]
    [t.join() for t in start_threads]
    if any(((c.state != u'up') for c in to_restart)):
        err = u'warning,    some    containers    failed    to    start'
        log_event(self, err, logging.WARNING)
