

def handle_control(self, req, worker_id):
    logger.info('Request: {}, worker_id: {}'.format(req, worker_id))
    response = None
    if (req == 'is_main_worker?'):
        if (not self.main_worker):
            self.main_worker = worker_id
        response = (self.main_worker == worker_id)
    elif (req == 'seed'):
        response = self.seed_generator.randint(100000)
    elif (req == 'done'):
        self.worker_is_done(worker_id)
    else:
        raise ValueError(('Unknown request ' + req))
    logger.info('Response: {}'.format(response))
    return response

dataset/ETHPy150Open mila-udem/blocks-extras/blocks_extras/extensions/synchronization.py SynchronizeController.handle_control/original