Receive an event from the minion and fire it on the master event
        interface

        :param dict load: The minion payload
968898
def _minion_event(self, load):
        '''
        
        '''
        load = self.__verify_load(load, ('id', 'tok'))
        if load is False:
            return {}
        # Route to master event bus
        self.masterapi._minion_event(load)
        # Process locally
        self._handle_minion_event(load)
275647
def load(self, callback):
        
        if callback is None:
            def callb():
                """No-op"""
                pass
            callback = callb
        if len(self._loaded_callbacks) == 0:
            self._request_module_status()
            self._request_channel_name()
        else:
            print("++++++++++++++++++++++++++++++++++")
        self._loaded_callbacks.append(callback)
        self._load()
1078692
def _emit(self, event):
        
        if (event.get('interface') is not iaxiom.IStatEvent and
            'athena_send_messages' not in event and
            'athena_received_messages' not in event):
            return

        out = []
        for k, v in event.iteritems():
            if k in ('system', 'message', 'interface', 'isError'):
                continue
            if not isinstance(v, unicode):
                v = str(v).decode('ascii')
            out.append(dict(key=k.decode('ascii'), value=v))
        self.callRemote(StatUpdate, data=out)
1354243
def trigger(self, target: str, trigger: str, parameters: Dict[str, Any]={}):
		
		pass
770004
def get_event(self, client, check):
        
        data = self._request('GET', '/events/{}/{}'.format(client, check))
        return data.json()
637515
def handle_event(event)
      if event.is_a?(Hash)
        if ["Push", "Request"].include?(event[:type])
          # Use next_tick to ensure that on main reactor thread
          # so that any data access is thread safe
          EM_S.next_tick do
            begin
              if (result = @dispatcher.dispatch(event_to_packet(event))) && event[:type] == "Request"
                @client.notify(result_to_event(result), [result.to])
              end
            rescue Dispatcher::DuplicateRequest
            rescue Exception => e
              ErrorTracker.log(self, "Failed sending response for <#{event[:uuid]}>", e)
            end
          end
        elsif event[:type] == "Result"
          if (data = event[:data]) && (result = data[:result]) && result.respond_to?(:non_delivery?) && result.non_delivery?
            Log.info("Non-delivery of event <#{data[:request_uuid]}>: #{result.content}")
          else
            ErrorTracker.log(self, "Unexpected Result event from #{event[:from]}: #{event.inspect}")
          end
        else
          ErrorTracker.log(self, "Unrecognized event type #{event[:type]} from #{event[:from]}")
        end
      else
        ErrorTracker.log(self, "Unrecognized event: #{event.class}")
      end
      nil
    end
387303
def deliver_hook(self, instance, payload_override=None):
        
        payload = payload_override or self.serialize_hook(instance)
        if getattr(settings, 'HOOK_DELIVERER', None):
            deliverer = get_module(settings.HOOK_DELIVERER)
            deliverer(self.target, payload, instance=instance, hook=self)
        else:
            client.post(
                url=self.target,
                data=json.dumps(payload, cls=DjangoJSONEncoder),
                headers={'Content-Type': 'application/json'}
            )

        signals.hook_sent_event.send_robust(sender=self.__class__, payload=payload, instance=instance, hook=self)
        return None
2022
def fire_master(data, tag, preload=None, timeout=60):
    '''
    
    '''
    if (__opts__.get('local', None) or __opts__.get('file_client', None) == 'local') and not __opts__.get('use_master_when_local', False):
        #  We can't send an event if we're in masterless mode
        log.warning('Local mode detected. Event with tag %s will NOT be sent.', tag)
        return False

    if preload or __opts__.get('__cli') == 'salt-call':
        # If preload is specified, we must send a raw event (this is
        # slower because it has to independently authenticate)
        if 'master_uri' not in __opts__:
            __opts__['master_uri'] = 'tcp://{ip}:{port}'.format(
                    ip=salt.utils.zeromq.ip_bracket(__opts__['interface']),
                    port=__opts__.get('ret_port', '4506')  # TODO, no fallback
                    )
        masters = list()
        ret = None
        if 'master_uri_list' in __opts__:
            for master_uri in __opts__['master_uri_list']:
                masters.append(master_uri)
        else:
            masters.append(__opts__['master_uri'])
        auth = salt.crypt.SAuth(__opts__)
        load = {'id': __opts__['id'],
                'tag': tag,
                'data': data,
                'tok': auth.gen_token(b'salt'),
                'cmd': '_minion_event'}

        if isinstance(preload, dict):
            load.update(preload)

        for master in masters:
            channel = salt.transport.client.ReqChannel.factory(__opts__, master_uri=master)
            try:
                channel.send(load, timeout=timeout)
                # channel.send was successful.
                # Ensure ret is True.
                ret = True
            except Exception:
                # only set a False ret if it hasn't been sent atleast once
                if ret is None:
                    ret = False
            finally:
                channel.close()
        return ret
    else:
        # Usually, we can send the event via the minion, which is faster
        # because it is already authenticated
        try:
            me = salt.utils.event.MinionEvent(__opts__, listen=False, keep_loop=True)
            return me.fire_event({'data': data, 'tag': tag, 'events': None, 'pretag': None}, 'fire_master')
        except Exception:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
            log.debug(lines)
            return False
1137552
def _pillar(self, load):
        '''
        
        '''
        if any(key not in load for key in ('id', 'grains')):
            return False
#        pillar = salt.pillar.Pillar(
        log.debug('Master _pillar using ext: %s', load.get('ext'))
        pillar = salt.pillar.get_pillar(
                self.opts,
                load['grains'],
                load['id'],
                load.get('saltenv', load.get('env')),
                load.get('ext'),
                self.mminion.functions,
                pillar_override=load.get('pillar_override', {}))
        data = pillar.compile_pillar()
        if self.opts.get('minion_data_cache', False):
            self.cache.store('minions/{0}'.format(load['id']),
                             'data',
                             {'grains': load['grains'], 'pillar': data})
            if self.opts.get('minion_data_cache_events') is True:
                self.event.fire_event({'comment': 'Minion data cache refresh'}, salt.utils.event.tagify(load['id'], 'refresh', 'minion'))
        return data
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)
220673
def _fire_ret_load_specific_fun(self, load, fun_index=0):
        '''
        
        '''
        if isinstance(load['fun'], list):
            # Multi-function job
            fun = load['fun'][fun_index]
            # 'retcode' was already validated to exist and be non-zero
            # for the given function in the caller.
            if isinstance(load['retcode'], list):
                # Multi-function ordered
                ret = load.get('return')
                if isinstance(ret, list) and len(ret) > fun_index:
                    ret = ret[fun_index]
                else:
                    ret = {}
                retcode = load['retcode'][fun_index]
            else:
                ret = load.get('return', {})
                ret = ret.get(fun, {})
                retcode = load['retcode'][fun]
        else:
            # Single-function job
            fun = load['fun']
            ret = load.get('return', {})
            retcode = load['retcode']

        try:
            for tag, data in six.iteritems(ret):
                data['retcode'] = retcode
                tags = tag.split('_|-')
                if data.get('result') is False:
                    self.fire_event(
                        data,
                        '{0}.{1}'.format(tags[0], tags[-1])
                    )  # old dup event
                    data['jid'] = load['jid']
                    data['id'] = load['id']
                    data['success'] = False
                    data['return'] = 'Error: {0}.{1}'.format(
                        tags[0], tags[-1])
                    data['fun'] = fun
                    data['user'] = load['user']
                    self.fire_event(
                        data,
                        tagify([load['jid'],
                                'sub',
                                load['id'],
                                'error',
                                fun],
                               'job'))
        except Exception:
            pass
527393
def send(self, url, data, headers):
        
        eventlet.spawn(self._send_payload, (url, data, headers))
515669
def trigger(self, event, **kwargs):
        
        with self._handlers.trigger_mutex:
            event = prime_event(event, self.__class__.__name__, **kwargs)

            for handler in self._handlers.async_handlers[event]:
                asynchronous(handler, event)
            for handler in self._handlers.sync_handlers[event]:
                synchronous(handler, event)
470028
def emit(self, event, *args, **kwargs):
        
        self._emit(event, self, *args, **kwargs)
725145
def receive(self, content, **kwargs):
        
        self.connection_context = DjangoChannelConnectionContext(self.message)
        self.subscription_server = DjangoChannelSubscriptionServer(graphene_settings.SCHEMA)
        self.subscription_server.on_open(self.connection_context)
        self.subscription_server.handle(content, self.connection_context)
1236420
def receive(self, data, api_context):
        """"""
        self.log.debug(f"Putting data on the pipeline: {data}")
        result = {
            "api_contexts": self.api_contexts,
            "api_context": api_context,
            "strategy": dict(),  # Shared strategy data
            "result": data,
            "log_level": api_context["log_level"],
        }
        self.strat.execute(self.strategy_context_schema().load(result).data)
526440
function _onLoadEventFired(event, res) {
        // res = {timestamp}
        Inspector.DOM.getDocument(function onGetDocument(res) {
            exports.trigger("getDocument", res);
            // res = {root}
            _idToNode = {};
            _pendingRequests = 0;
            exports.root = new DOMNode(exports, res.root);
        });
    }