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


Python asyncore_25.loop函数代码示例

本文整理汇总了Python中supervisor.medusa.asyncore_25.loop函数的典型用法代码示例。如果您正苦于以下问题:Python loop函数的具体用法?Python loop怎么用?Python loop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _tailf

    def _tailf(self, path):
        self.ctl.output('==> Press Ctrl-C to exit <==')

        username = self.ctl.options.username
        password = self.ctl.options.password
        handler = None
        try:
            # Python's urllib2 (at least as of Python 2.4.2) isn't up
            # to this task; it doesn't actually implement a proper
            # HTTP/1.1 client that deals with chunked responses (it
            # always sends a Connection: close header).  We use a
            # homegrown client based on asyncore instead.  This makes
            # me sad.
            import supervisor.http_client as http_client
            if self.listener is None:
                listener = http_client.Listener()
            else:
                listener = self.listener # for unit tests
            handler = http_client.HTTPHandler(listener, username, password)
            handler.get(self.ctl.options.serverurl, path)
            asyncore.loop()
        except KeyboardInterrupt:
            if handler:
                handler.close()
            self.ctl.output('')
            return
开发者ID:pataquets,项目名称:supervisor,代码行数:26,代码来源:supervisorctl.py

示例2: test

 def test (port='8021'):
     fs = ftp_server (
             unix_authorizer(),
             port=int(port)
             )
     try:
         asyncore.loop()
     except KeyboardInterrupt:
         fs.log_info('FTP server shutting down. (received SIGINT)', 'warning')
         # close everything down on SIGINT.
         # of course this should be a cleaner shutdown.
         asyncore.close_all()
开发者ID:GulsahKose,项目名称:supervisor,代码行数:12,代码来源:ftp_server.py

示例3: map

        print 'usage: %s <host> <port> <request-size> <num-requests> <num-connections>\n' % sys.argv[0]
    else:
        host = sys.argv[1]

        ip = socket.gethostbyname (host)

        [port, request_size, num_requests, num_conns] = map (
                string.atoi, sys.argv[2:]
                )

        chain = build_request_chain (num_requests, host, request_size)

        t = timer()
        for i in range (num_conns):
            test_client ((host,port), chain)
        asyncore.loop()
        total_time = t.end()

        # ok, now do some numbers
        total_bytes = test_client.total_in
        num_trans = num_requests * num_conns
        throughput = float (total_bytes) / total_time
        trans_per_sec = num_trans / total_time

        sys.stderr.write ('total time: %.2f\n' % total_time)
        sys.stderr.write ('number of transactions: %d\n' % num_trans)
        sys.stderr.write ('total bytes sent: %d\n' % total_bytes)
        sys.stderr.write ('total throughput (bytes/sec): %.2f\n' % throughput)
        sys.stderr.write ('transactions/second: %.2f\n' % trans_per_sec)
        sys.stderr.write ('max concurrent connections: %d\n' % test_client.max_concurrent)
开发者ID:AhmadAabed,项目名称:supervisor-c9,代码行数:30,代码来源:test_11.py

示例4: run

 def run(self): # pragma: no cover
     self.output_handler.get(self.ctl.options.serverurl,
                             '/logtail/%s/stdout'%self.program)
     self.error_handler.get(self.ctl.options.serverurl,
                            '/logtail/%s/stderr'%self.program)
     asyncore.loop()
开发者ID:pataquets,项目名称:supervisor,代码行数:6,代码来源:supervisorctl.py

示例5: len

    import string

    if '--poll' in sys.argv:
        sys.argv.remove ('--poll')
        use_poll=1
    else:
        use_poll=0

    if len(sys.argv) == 1:
        print(('usage: %s\n' \
        '  (as a server) [--poll] -s <ip> <port>\n' \
        '  (as a client) [--poll] -c <ip> <port> <packet-size> <num-packets> <num-connections>\n' % sys.argv[0]))
        sys.exit(0)
    if sys.argv[1] == '-s':
        s = test_server ((sys.argv[2], string.atoi (sys.argv[3])))
        asyncore.loop(use_poll=use_poll)
    elif sys.argv[1] == '-c':
        # create the packet
        packet = string.atoi(sys.argv[4]) * 'B'
        host = sys.argv[2]
        port = string.atoi (sys.argv[3])
        num_packets = string.atoi (sys.argv[5])
        num_conns = string.atoi (sys.argv[6])

        t = timer()
        for i in range (num_conns):
            test_client ((host,port), packet, num_packets)
        asyncore.loop(use_poll=use_poll)
        total_time = t.end()

        # ok, now do some numbers
开发者ID:WLPhoenix,项目名称:supervisor-py3k,代码行数:31,代码来源:test_lb.py

示例6: start_Server

def start_Server():
#    ftpServ = ftp_server.ftp_server( ftp_server.anon_authorizer( "D:\MyDocuments\MyDownloads"), port=21 )
    ftpServ = ftp_server.ftp_server( Win32Authorizer(), port=21 )
    asyncore.loop()
开发者ID:WLPhoenix,项目名称:supervisor-py3k,代码行数:4,代码来源:winFTPserver.py

示例7: print_function

if __name__ == '__main__':
    if '-s' in sys.argv:
        sys.argv.remove ('-s')
        print_function('Enter password: ', end='')
        password = raw_input()
    else:
        password = None

    if '-e' in sys.argv:
        sys.argv.remove ('-e')
        encrypt = 1
    else:
        encrypt = 0

    if len(sys.argv) > 1:
        port = int(sys.argv[1])
    else:
        port = 8023

    if password is not None:
        s = secure_monitor_server (password, '', port)
        if encrypt:
            s.channel_class = secure_encrypted_monitor_channel
            #noinspection PyUnresolvedReferences
            import sapphire
            s.cipher = sapphire
    else:
        s = monitor_server ('', port)

    asyncore.loop(use_poll=1)
开发者ID:lmcdonough,项目名称:supervisor,代码行数:30,代码来源:monitor.py

示例8: run

 def run(self):
     self.output_handler.get(self.ctl.options.serverurl, "/logtail/%s/stdout" % self.program)
     self.error_handler.get(self.ctl.options.serverurl, "/logtail/%s/stderr" % self.program)
     asyncore.loop()
开发者ID:JeancarloBarrios,项目名称:adtp,代码行数:4,代码来源:supervisorctl.py

示例9: profile_loop

 def profile_loop ():
     try:
         asyncore.loop()
     except KeyboardInterrupt:
         pass
开发者ID:lmcdonough,项目名称:supervisor,代码行数:5,代码来源:http_server.py


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