'Executes the the task.
If :attr:`.enabled` is False task is not executed. Certain :attr:`.options`
affect how execution is handled.
- :attr:`.options.disable_phases` is a list of phases that are not enabled
for this execution.
- :attr:`.options.inject` is a list of :class:`Entry` instances used instead
of running input phase.'

@use_task_logging
def execute(self):

    try:
        self.finished_event.clear()
        if self.options.cron:
            self.manager.db_cleanup()
        fire_event(u'task.execute.started', self)
        while True:
            self._execute()
            if (self._rerun and (self._rerun_count < self.max_reruns) and (self._rerun_count < Task.RERUN_MAX)):
                log.info(u'Rerunning    the    task    in    case    better    resolution    can    be    achieved.')
                self._rerun_count += 1
                self._all_entries = EntryContainer()
                self._rerun = False
                continue
            elif self._rerun:
                log.info((u'Task    has    been    re-run    %s    times    already,    stopping    for    now' % self._rerun_count))
            break
        fire_event(u'task.execute.completed', self)
    finally:
        self.finished_event.set()
