def METHOD_NAME(self, size):
    with self._lock:
        logging.info('reset workers: {}'.format(size))
        self._states.clear()
        self._workers.clear()
        self._barrier = threading.Barrier(parties=size, action=self._action)
        self._rendezvous_id += 1
        self._size = size