当前位置: 首页>>代码示例>>Python>>正文


Python MultiService.__init__方法代码示例

本文整理汇总了Python中twisted.application.service.MultiService.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MultiService.__init__方法的具体用法?Python MultiService.__init__怎么用?Python MultiService.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.application.service.MultiService的用法示例。


在下文中一共展示了MultiService.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, config=None):
        MultiService.__init__(self)
        self.config = config

        # Create a tasks queue
        self.tasks = Tasks()
        self.tasks.setServiceParent(self)
开发者ID:pombredanne,项目名称:boiler,代码行数:9,代码来源:boiler.py

示例2: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self):
        MultiService.__init__(self)

        # Init pilots service --------------------------------------------------
        from minic.service.pilots import PilotsService
        pilots = PilotsService()
        pilots.setServiceParent(self)

        # Init objects service -------------------------------------------------
        from minic.service.objects import ObjectsService
        objects = ObjectsService()
        objects.setServiceParent(self)

        # Init missions service ------------------------------------------------
        from minic.service.missions import MissionsService
        log_watcher = LogWatchingService()
        missions = MissionsService(log_watcher)
        log_parser = EventLogParser((pilots, objects, missions, ))
        log_watcher.set_parser(log_parser)
        missions.setServiceParent(self)

        # Init console and DeviceLink parsers ----------------------------------
        console_parser = ConsoleParser((pilots, missions, ))
        device_link_parser = DeviceLinkParser()
        log_parser = EventLogParser((pilots, objects, missions, ))

        # Group parsers and services -------------------------------------------
        self.parsers = namedtuple(
            'commander_parsers', ['console', 'device_link', 'log'])(
            console_parser, device_link_parser, log_parser)
        self.services = namedtuple(
            'commander_services', ['pilots', 'objects', 'missions'])(
            pilots, objects, missions)
开发者ID:IL2HorusTeam,项目名称:minic,代码行数:35,代码来源:__init__.py

示例3: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
 def __init__(self, options):
     MultiService.__init__(self)
     self.options = options
     self.config = {}
     self.common_config = {}
     self.modules = []
     self.fail = False
开发者ID:hitsl,项目名称:bouser,代码行数:9,代码来源:service.py

示例4: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, config):
        MultiService.__init__(self)
        import os
        from bouser.utils import safe_traverse

        from twisted.internet import reactor
        from twisted.application import strports
        from bouser.web.resource import DefaultRootResource
        from bouser.web.site import BouserSite
        from bouser.proxied_logger import proxiedLogFormatter

        root_resource = DefaultRootResource()
        current_dir = os.path.dirname(__file__)
        site = BouserSite(
            root_resource,
            static_path=safe_traverse(config, 'static-path', default=os.path.join(current_dir, 'static')),
            template_path=safe_traverse(config, 'template-path', default=os.path.join(current_dir, 'templates')),
            logFormatter=proxiedLogFormatter)

        description = config.get('strport', 'tcp:%s:interface=%s' % (
            config.get('port', 5000),
            config.get('host', '127.0.0.1')
        ))

        self.cors_domain = config.get('cors-domain', 'http://127.0.0.1:5000/')
        allowed_domains = set(filter(None, config.get('allowed-domains', '').replace(',', ' ').split(' ')))
        self.allowed_domains = set(allowed_domains) | {self.cors_domain}

        service = strports.service(description, site, reactor=reactor)
        service.setServiceParent(self)

        self.root_resource = root_resource
        self.site = site
        self.service = service
开发者ID:hitsl,项目名称:bouser,代码行数:36,代码来源:service.py

示例5: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, ssl_cert, ssl_key, ssl_cert_chain, ssl_port,
                 dest_host, dest_port, server_name, status_port):
        """ Create a rageServerService.

        @param ssl_cert: the certificate text.
        @param ssl_key: the key text.
        @param ssl_port: the port to listen on with ssl.
        @param dest_host: destination hostname.
        @param dest_port: destination port.
        @param server_name: name of this server.
        """
        MultiService.__init__(self)
        self.heartbeat_writer = None
        if server_name is None:
            server_name = "anonymous_instance"
        self.server_name = server_name
        self.factory = SSLProxyFactory(ssl_port, dest_host, dest_port,
                                       self.server_name)
        ssl_context_factory = ProxyContextFactory(ssl_cert, ssl_key,
                                                  ssl_cert_chain)
        self.ssl_service = SSLServer(ssl_port, self.factory,
                                     ssl_context_factory)
        self.ssl_service.setName("SSL")
        self.ssl_service.setServiceParent(self)
        # setup the status service
        self.status_service = create_status_service(self.factory, status_port)
        self.status_service.setServiceParent(self)
        # disable ssl compression
        if config.ssl_proxy.disable_ssl_compression:
            disable_ssl_compression(logger)
开发者ID:cloudfleet,项目名称:filesync-server,代码行数:32,代码来源:ssl_proxy.py

示例6: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, settings=None, channel=None):

        MultiService.__init__(self)

        # Make channel object from application settings configuration object
        self.setupChannel(channel=channel)

        # Shortcut to global settings
        self.config = settings

        if not 'port' in self.config['grafana']:
            self.config['grafana']['port'] = '3000'

        name = self.__class__.__name__
        log.info('Starting GrafanaManager "{}". grafana={}:{}'.format(
            name,
            self.config['grafana']['host'],
            self.config['grafana']['port']))

        # Initialize key cache
        # Utility functions for remembering whether the dashboard has been created already.
        # This is important as we would otherwise talk to Grafana for each ingress measurement (on each hit).
        self.keycache = KeyCache()

        # Boot further child services
        self.boot_workers()

        # Connect to Grafana API
        self.connect()
开发者ID:hiveeyes,项目名称:kotori,代码行数:31,代码来源:manager.py

示例7: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
 def __init__(self, kz_client, interval, partitioner_path, buckets,
              time_boundary, log, got_buckets,
              clock=None):
     """
     :param log: a bound log
     :param kz_client: txKazoo client
     :param partitioner_path: ZooKeeper path, used for partitioning
     :param buckets: iterable of buckets to distribute between
         nodes. Ideally there should be at least as many elements as nodes
         taking part in this partitioner. This should be a sequence of str.
     :param time_boundary: time to wait for partitioning to stabilize.
     :param got_buckets: Callable which will be called with a list of
         buckets when buckets have been allocated to this node.
     :param clock: clock to use for checking the buckets on an interval.
     """
     MultiService.__init__(self)
     self.kz_client = kz_client
     self.partitioner_path = partitioner_path
     self.buckets = buckets
     self.log = log
     self.got_buckets = got_buckets
     self.time_boundary = time_boundary
     ts = TimerService(interval, self.check_partition)
     ts.setServiceParent(self)
     ts.clock = clock
     self._old_buckets = []
开发者ID:rackerlabs,项目名称:otter,代码行数:28,代码来源:zkpartitioner.py

示例8: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
 def __init__(self, parser):
     MultiService.__init__(self)
     NamedComponentized.__init__(self, parser.parse_args().game)
     if not self.config.verbose:
         HTTPClientFactory.noisy = False
     registerGlobal(self, IClient)
     self.addService(IWebWorld(self))
开发者ID:isnok,项目名称:mpmf,代码行数:9,代码来源:Client.py

示例9: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, apserver, name=None, host="0.0.0.0", port=22555, index=-1, device_id=None):
        MultiService.__init__(self)

        self.apserver = IAirPlayServer(apserver)

        if device_id:
            self.deviceid = device_id
        else:
            macstr = "%012X" % uuid.getnode()
            self.deviceid = ''.join("%s:" % macstr[i:i + 2] for i in range(0, len(macstr), 2))[:-1]

        # 0x77 instead of 0x07 in order to support AirPlay from ordinary apps;
        # also means that the body for play will be a binary plist.
        self.features = 0x77
        self.model = "AppleTV2,1"

        # create TCP server
        TCPServer(port, self.create_site(), 100, interface=host).setServiceParent(self)

        # create avahi service
        if (name is None):
            name = "Airplay Service on " + platform.node()
        zconf = ZeroconfService(name, port=port, stype="_airplay._tcp",
                                text=["deviceid=" + self.deviceid, "features=" + hex(self.features), "model=" + self.model],
                                index=index)
        zconf.setServiceParent(self)

        # for logging
        self.name_ = name
        self.host = host
        self.port = port
开发者ID:fredrikaubert,项目名称:airpnp,代码行数:33,代码来源:AirPlayService.py

示例10: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, config_file):
        MultiService.__init__(self)

        self.config_file = SafeConfigParser()
        self.config_file.readfp(open(config_file))

        self.config = None
开发者ID:automatron,项目名称:automatron,代码行数:9,代码来源:controller.py

示例11: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self):
        MultiService.__init__(self)

        # Init shared storage which is used to share information about server
        # to the ouside world
        self.shared_storage = get_storage()

        # Init pilots service
        from commander.service.pilots import PilotService
        self.pilots = PilotService()
        self.pilots.setServiceParent(self)

        # Init objects service
        from commander.service.objects import ObjectsService
        self.objects = ObjectsService()
        self.objects.setServiceParent(self)

        # Init missions service with log watcher
        from commander.service.missions import MissionService
        log_watcher = LogWatchingService(settings.IL2_EVENTS_LOG_PATH)
        self.missions = MissionService(log_watcher)
        self.log_parser = EventLogParser(
            (self.pilots, self.objects, self.missions, ))
        log_watcher.set_parser(self.log_parser)
        self.missions.setServiceParent(self)

        # Init console and DeviceLink parsers
        self.console_parser = ConsoleParser((self.pilots, self.missions, ))
        self.dl_parser = DeviceLinkParser()
开发者ID:Kamyhin,项目名称:il2ds-events-commander,代码行数:31,代码来源:__init__.py

示例12: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
 def __init__(self, shared_path, server_name, server_path, jar_file=None):
     MultiService.__init__(self)
     self.shared_path = shared_path
     self.server_name = server_name
     self.server_path = server_path
     self.jar_file = jar_file
     self.players = set()
开发者ID:runfalk,项目名称:mark2,代码行数:9,代码来源:manager.py

示例13: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(
        self, dataStoreDirectory, subServiceFactory,
        dsnUser=None,
        testMode=False,
        reactor=None,
    ):
        """
        Initialize a L{OracleService} pointed at a data store directory.

        @param dataStoreDirectory: the directory to
        @type dataStoreDirectory: L{twext.python.filepath.CachingFilePath}

        @param subServiceFactory: a 1-arg callable that will be called with a
            1-arg callable which returns a DB-API cursor.
        @type subServiceFactory: C{callable}
        """

        MultiService.__init__(self)
        self.subServiceFactory = subServiceFactory
        self.dataStoreDirectory = dataStoreDirectory
        self.workingDir = self.dataStoreDirectory.child("working")

        self.dsnUser = dsnUser
        self.testMode = testMode

        self._reactor = reactor
开发者ID:eventable,项目名称:CalendarServer,代码行数:28,代码来源:suboracle.py

示例14: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self, ip_addr, sn_types=[], device_types=[], required_services=[]): # pylint: disable-msg=W0102
        """Initialize the service.

        Arguments:
        ip_addr           -- IP address for listening services.
        sn_types          -- list of device and/or service types to look for in
                             UPnP notifications and responses; other types will
                             be ignored. "upnp:rootdevice" is automatically
                             tracked, and should not be in this list.
        device_types      -- list of interesting device types, used to filter
                             out devices based on their "deviceType" attribute.
                             An empty list means that all types are interesting.
        required_services -- if non-empty, list of services that the device
                             must have for it to be considered

        """
        MultiService.__init__(self)
        self._builders = {}
        self._devices = {}
        self._ignored = []
        self._sn_types = ['upnp:rootdevice'] + sn_types
        self._dev_types = device_types
        self._req_services = required_services
        self._ip_addr = ip_addr

        # create the UPnP listener service
        UpnpService(self._datagram_handler, ip_addr).setServiceParent(self)
        
        # create the periodic M-SEARCH request service
        msearch = MSearchRequest(self._datagram_handler)
        TimerService(DISCOVERY_INTERVAL, self._msearch_discover,
                     msearch).setServiceParent(self)
开发者ID:fredrikaubert,项目名称:airpnp,代码行数:34,代码来源:device_discovery.py

示例15: __init__

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import __init__ [as 别名]
    def __init__(self):
        MultiService.__init__(self)

        self.config = read_configuration()
        self.factorylist = list()
        self.irc = False
        self.ircbots = list()
        self.configure_services()
开发者ID:MacLeek,项目名称:mh,代码行数:10,代码来源:service.py


注:本文中的twisted.application.service.MultiService.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。