def listen(self):
    try:
        status = MPI.Status()
        while True:
            logger.debug('Waiting for data')
            data = self.comm.recv(source=0, tag=MPI.ANY_TAG, status=status)
            logger.debug('Received data: {}', data)
            if (status.Get_tag() == DIETAG):
                break
            else:
                self.run_control.run_task(data['task'])
                data['task'].status = 'done'
                self.comm.send(data, dest=0, tag=WORKTAG)
        logger.debug('Finished')
    except Exception as e:
        logger.error(e)
        data = {'command': 'error', 'msg': str(e)}
        self.comm.send(data, dest=0, tag=WORKTAG)
        return
def listen(self):
    try:
        status = MPI.Status()
        while True:
            logger.debug('Waiting for data')
            data = self.comm.recv(source=0, tag=MPI.ANY_TAG, status=status)
            logger.debug('Received data: {}', data)
            if (status.Get_tag() == DIETAG):
                break
            else:
                self.run_control.run_task(data['task'])
                data['task'].status = 'done'
                self.comm.send(data, dest=0, tag=WORKTAG)
        logger.debug('Finished')
    except Exception as e:
        logger.error(e)
        data = {'command': 'error', 'msg': str(e)}
        self.comm.send(data, dest=0, tag=WORKTAG)
        return