Executes registered task event plugins for the provided event and task.

        `event`
            Name of the event to trigger for the plugin:
                ('task_start', 'task_run', 'task_end')
        `task`
            ``Task`` instance.
348830
def run_event_hooks(event, task):
    

    # get chain of classes registered for this event
    call_chain = _event_hooks.get(event)

    if call_chain:
        # lookup the associated class method for this event
        event_methods = {
            'task_start': 'on_taskstart',
            'task_run': 'on_taskrun',
            'task_end': 'on_taskend'
        }
        method = event_methods.get(event)

        if method:
            for _, get_plugin in call_chain:
                plugin_obj = get_plugin()

                if not _is_plugin_disabled(plugin_obj):
                    try:
                        getattr(plugin_obj, method)(task)  # execute
                    except Exception:
                        # TODO: log these issues for plugin author or user
                        pass
34377
def exec_hook(event_name, *args, &block)
      @hooks[event_name.to_s].map do |hook_name, callable|
        begin
          callable.call(*args, &block)
        rescue PuppetDebugger::Exception::Error, ::RuntimeError => e
          errors << e
          e
        end
      end.last
    end
323863
def fire(self, *args, **kwargs):

        

        for func in self._getfunctionlist():
            if type(func) == EventHandler:
                func.fire(*args, **kwargs)
            else:
                func(self.obj, *args, **kwargs)
1119163
def execute(self, env, args):
        

        tasks = env.task.get_list_info()
        if not tasks:
            env.io.write("No tasks found.")

        else:
            if args.verbose:
                _print_tasks(env, tasks, mark_active=True)

            else:
                if env.task.active:
                    active_task = env.task.name
                else:
                    active_task = None

                for task, options, blocks in tasks:
                    if task == active_task:
                        env.io.success(task + ' *')
                    else:
                        if options is None and blocks is None:
                            env.io.error(task + ' ~')
                        else:
                            env.io.write(task)
215219
function(params) {
    var success = function(result) {
      if (!EventHandlers.hasOwnProperty(result.eventName)) {
        return;
      }

      for (var index in EventHandlers[result.eventName]) {
        EventHandlers[result.eventName][index].apply(undefined, [result.value]);
      }
    };

    exec(success, null, PLUGIN_NAME, "init", [params]);
  }
964412
def fire_event(self, name, exc=None, data=None):
        
        if self._events and name in self._events:
            self._events[name].fire(exc=exc, data=data)
693105
def execute_hook(self, event_name):
        """"""
        hook = self.settings.hooks.get_string('{!s}'.format(event_name))
        if hook is not None and hook != "":
            hook = hook.split()
            try:
                subprocess.Popen(hook)
            except OSError as oserr:
                if oserr.errno == 8:
                    log.error("Hook execution failed! Check shebang at first line of %s!", hook)
                    log.debug(traceback.format_exc())
                else:
                    log.error(str(oserr))
            except Exception as e:
                log.error("hook execution failed! %s", e)
                log.debug(traceback.format_exc())
            else:
                log.debug("hook on event %s has been executed", event_name)
64533
function(event) {
  if (event) {
    var executeDispatch = EventPluginUtils.executeDispatch;
    // Plugins can provide custom behavior when dispatching events.
    var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
    if (PluginModule && PluginModule.executeDispatch) {
      executeDispatch = PluginModule.executeDispatch;
    }
    EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);

    if (!event.isPersistent()) {
      event.constructor.release(event);
    }
  }
}
9363
def emit(self, event, *args, **kwargs):
        
        for func in self._registered_events[event].values():
            func(*args, **kwargs)
1198579
def trigger!(event, *args)
      event = event.to_sym

      if @listeners && @listeners[event]
        # TODO: We have to dup here because one trigger might remove another
        @listeners[event].dup.each do |listener|
          # Call the event on each listener
          listener.call(*args)
        end
      end
    end
1327510
def execute_tasks(self):
        
        for t in self.tasks:
            print('RUNNING ' + str(t.task_id) + ' = ' + t.name)
            t.execute()
            if t.success != '__IGNORE__RESULT__':
                print(t)
                print('TASK RESULT :', t.result, ' but success = ' , t.success )
                if t.result != t.success:
                    #raise Exception('Project execution failed at task ' + str(t.task_id) + ' = ' + t.name)
                    print('ABORTING TASK EXECUTION SEQUENCE'  + str(t.task_id) + ' = ' + t.name)
                    break
1329889
def start_log_task(task, logger=logging, level='info'):
    
    getattr(logger, level)(START_TASK_TRIGGER_MSG % task)
657090
def trigger(self_, *param_names):
        
        events = self_.self_or_cls.param._events
        watchers = self_.self_or_cls.param._watchers
        self_.self_or_cls.param._events  = []
        self_.self_or_cls.param._watchers = []
        param_values = dict(self_.get_param_values())
        params = {name: param_values[name] for name in param_names}
        self_.self_or_cls.param._TRIGGER = True
        self_.set_param(**params)
        self_.self_or_cls.param._TRIGGER = False
        self_.self_or_cls.param._events = events
        self_.self_or_cls.param._watchers = watchers
1156903
def _event_register(self, control):
        
        log = self._params.get('log', self._discard)
        if 'events' not in self._config_running:
            log.debug("No events present for task '%s'", self._name)
            return
        for event in self._config_running['events']:
            ev_type = self._get(event.get('type'))
            if not ev_type:
                log.error("Ignoring event in task '%s' with no type", self._name)
                continue
            ev = self._make_event_target(event, control)
            if ev is None:
                continue
            log.debug("Adding event type '%s' for task '%s'", ev_type, self._name)
            if ev_type == 'self':
                self._legion.file_add(ev, self.get_path())
            elif ev_type == 'python':
                self._legion.module_add(ev, path=self.get_path())
            elif ev_type == 'file_change':
                path = self._get_list(event.get('path'))
                if path:
                    self._legion.file_add(ev, _fmt_context(path, self._context))
                else:
                    log.error("Ignoring %s event in task '%s' with no path", ev_type, self._name)
            elif ev_type in ['stop', 'restart']:
                log.debug("No task '%s' registration action for '%s' event", self._name, ev_type)
            else:
                log.error("Ignoring unknown event type '%s' in task '%s'", ev_type, self._name)
842420
def trigger (self, event, *args, **kwargs):
        
        if self._events.has_key(event):
            for _callback in self._events[event]:
                try:
                    _callback(args, kwargs)
                except TypeError:
                    _callback()
530092
def execute(self, env, args):
        

        task_name = args.task_name
        clone_task = args.clone_task

        if not env.task.create(task_name, clone_task):
            raise errors.FocusError(u'Could not create task "{0}"'
                                    .format(task_name))

        # open in task config in editor
        if not args.skip_edit:
            task_config = env.task.get_config_path(task_name)

            if not _edit_task_config(env, task_config, confirm=True):
                raise errors.FocusError(u'Could not open task config: {0}'
                                        .format(task_config))
640954
def trigger_hook(self, __name, *args, **kwargs):
        '''  '''
        return [hook(*args, **kwargs) for hook in self._hooks[__name][:]]