コード例 #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,
        )
コード例 #2
0
ファイル: hub.py プロジェクト: AdamWill/fedmsg
    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,
        )
コード例 #3
0
ファイル: test_utils.py プロジェクト: austinvernsonger/fedmsg
def test_load_class_succeed():
    cls = load_class("shelve:Shelf")
    from shelve import Shelf

    eq_(cls, Shelf)
コード例 #4
0
ファイル: test_utils.py プロジェクト: austinvernsonger/fedmsg
def test_load_class_attribute_error():
    cls = load_class("shelve:ThisIsNotAClass")
コード例 #5
0
ファイル: test_utils.py プロジェクト: austinvernsonger/fedmsg
def test_load_class_import_error():
    cls = load_class("thisisnotapackage:ThisIsNotAClass")
コード例 #6
0
ファイル: test_utils.py プロジェクト: mbooth101/fedmsg
def test_load_class_succeed():
    cls = load_class("shelve:Shelf")
    from shelve import Shelf
    eq_(cls, Shelf)
コード例 #7
0
ファイル: test_utils.py プロジェクト: mbooth101/fedmsg
def test_load_class_attribute_error():
    cls = load_class("shelve:ThisIsNotAClass")
コード例 #8
0
ファイル: test_utils.py プロジェクト: mbooth101/fedmsg
def test_load_class_import_error():
    cls = load_class("thisisnotapackage:ThisIsNotAClass")