Example #1
0
    def run(self):
        # Check if the user wants the websocket server to run
        if self.config['moksha.livesocket.websocket.port']:
            self.config['moksha.livesocket.backend'] = 'websocket'

        # If the user wants to override any consumers installed on the system
        # and *only* run the ones they want to, they can do that.
        consumers = None
        if self.config['explicit_hub_consumers']:
            locations = self.config['explicit_hub_consumers'].split(',')
            locations = [load_class(location) for location in locations]

        # Rephrase the fedmsg-config.py config as moksha *.ini format for
        # zeromq. If we're not using zeromq (say, we're using STOMP), then just
        # assume that the moksha configuration is specified correctly already
        # in /etc/fedmsg.d/
        if self.config.get('zmq_enabled', True):
            moksha_options = dict(zmq_subscribe_endpoints=','.join(
                ','.join(bunch)
                for bunch in self.config['endpoints'].values()), )
            self.config.update(moksha_options)

        self.set_rlimit_nofiles()

        # Note that the hub we kick off here cannot send any message.  You
        # should use fedmsg.publish(...) still for that.
        from moksha.hub import main
        main(
            # Pass in our config dict
            options=self.config,
            # Only run the specified consumers if any are so specified.
            consumers=consumers,
            # Tell moksha to quiet its logging.
            framework=False,
        )
Example #2
0
    def run(self):
        # Check if the user wants the websocket server to run
        if self.config['moksha.livesocket.websocket.port']:
            self.config['moksha.livesocket.backend'] = 'websocket'

        # If the user wants to override any consumers installed on the system
        # and *only* run the ones they want to, they can do that.
        consumers = None
        if self.config['explicit_hub_consumers']:
            locations = self.config['explicit_hub_consumers'].split(',')
            locations = [load_class(location) for location in locations]

        # Rephrase the fedmsg-config.py config as moksha *.ini format.
        # Note that the hub we kick off here cannot send any message.  You
        # should use fedmsg.publish(...) still for that.
        moksha_options = dict(
            zmq_subscribe_endpoints=','.join(
                ','.join(bunch) for bunch in self.config['endpoints'].values()
            ),
        )
        self.config.update(moksha_options)

        from moksha.hub import main
        main(
            # Pass in our config dict
            options=self.config,
            # Only run the specified consumers if any are so specified.
            consumers=consumers,
            # Tell moksha to quiet its logging.
            framework=False,
        )
Example #3
0
def test_load_class_succeed():
    cls = load_class("shelve:Shelf")
    from shelve import Shelf

    eq_(cls, Shelf)
Example #4
0
def test_load_class_attribute_error():
    cls = load_class("shelve:ThisIsNotAClass")
Example #5
0
def test_load_class_import_error():
    cls = load_class("thisisnotapackage:ThisIsNotAClass")
Example #6
0
def test_load_class_succeed():
    cls = load_class("shelve:Shelf")
    from shelve import Shelf
    eq_(cls, Shelf)
Example #7
0
def test_load_class_attribute_error():
    cls = load_class("shelve:ThisIsNotAClass")
Example #8
0
def test_load_class_import_error():
    cls = load_class("thisisnotapackage:ThisIsNotAClass")