'Checks if the executor agrees with the state of task instances
that are running
:param started: dict of key, task to verify'

def _manage_executor_state(self, started):

    executor = self.executor
    for (key, state) in list(executor.get_event_buffer().items()):
        if (key not in started):
            self.logger.warning(u'{}    state    {}    not    in    started={}'.format(key, state, started.values()))
            continue
        ti = started[key]
        ti.refresh_from_db()
        self.logger.debug(u'Executor    state:    {}    task    {}'.format(state, ti))
        if ((state == State.FAILED) or (state == State.SUCCESS)):
            if ((ti.state == State.RUNNING) or (ti.state == State.QUEUED)):
                msg = u'Executor    reports    task    instance    {}    finished    ({})    although    the    task    says    its    {}.    Was    the    task    killed    externally?'.format(ti, state, ti.state)
                self.logger.error(msg)
                ti.handle_failure(msg)
