コード例 #1
0
ファイル: test_litmus.py プロジェクト: Nonolost/wsgidav
    def test_litmus_with_authentication(self):
        """Run litmus test suite on HTTP with authentification.

        This test passes
        """
        try:
            proc = Process(target=run_wsgidav_server, args=(True, False))
            proc.daemon = True
            proc.start()
            time.sleep(1)

            try:
                self.assertEqual(subprocess.call(["litmus", "http://127.0.0.1:8080/", "tester", "secret"]),
                                 0,
                                 "litmus suite failed: check the log")
            except OSError:
                print "*" * 70
                print "This test requires the litmus test suite."
                print "See http://www.webdav.org/neon/litmus/"
                print "*" * 70
                raise

        finally:
            proc.terminate()
            proc.join()
コード例 #2
0
    def test_litmus_with_authentication(self):
        """Run litmus test suite on HTTP with authentification.

        This test passes
        """
        try:
            proc = Process(target=run_wsgidav_server, args=(True, False))
            proc.daemon = True
            proc.start()
            time.sleep(1)

            try:
                self.assertEqual(
                    subprocess.call([
                        "litmus", "http://127.0.0.1:8080/", "tester", "secret"
                    ]), 0, "litmus suite failed: check the log")
            except OSError:
                print "*" * 70
                print "This test requires the litmus test suite."
                print "See http://www.webdav.org/neon/litmus/"
                print "*" * 70
                raise

        finally:
            proc.terminate()
            proc.join()
コード例 #3
0
ファイル: report_control.py プロジェクト: robertbetts/Kew
def process(host,port):
    from multiprocessing.process import Process
    
    p = Process(target=run, args=(host,port))  
    p.daemon = True
    p.start()     
    return p
コード例 #4
0
def _launch(type_name, config, is_important):
    plugin_clazz = _get_type(type_name)
    if not plugin_clazz:
        logging.warn('could not find %s plugin' % type_name)

    d = plugin_clazz(config)

    p = Process(target=d.start)
    p.daemon = not is_important
    p.name = 'plugin: %s' % d.name
    p.start()
コード例 #5
0
def main():
    
    ''' parse the command line - new up the appl and listen on port '''
    if os.path.isfile("../kew_pe.conf"):
        print ("Loading config file ../kew_pe.conf")
        options.parse_config_file("../kew_pe.conf")
    options.parse_command_line()
        
    logging.basicConfig(level=logging.DEBUG)
    #report_control.process('localhost',8081)
    
    process = Process(target=report_control.run, name="report_control", kwargs={'host':'localhost', 'port':8081})
    process.daemon = True
    process.start()           
コード例 #6
0
ファイル: server.py プロジェクト: dmr/smart-grid-actor
def start_actor_server(
        actor,
        host_port_tuple=None,
        start_in_background_thread=False,
        log_requests=False,
        server_starter=start_bjoern_server
        ):
    if server_starter != start_bjoern_server:
        print("Using builtin server (slow)")

    if not host_port_tuple:
        # if no specific port is given,
        # run on free port
        host_port_tuple = ('', 0)

    port = host_port_tuple[1]
    if host_port_tuple[1] == 0:
        port = get_free_port(host_port_tuple)

    host_name = get_host_name(host_port_tuple[0])

    host_uri = 'http://{0}:{1}'.format(host_name, port)
    print("Running server on {0}".format(host_uri))

    wsgi_application = get_wsgi_application(
        actor, host_uri,
        log_requests=log_requests
    )

    if start_in_background_thread:
        process = Process(
            target=server_starter,
            args=(wsgi_application, host_name, port)
        )
        process.daemon = True
        process.start()
        return host_uri, process

    server_starter(wsgi_application, host_name, port)
コード例 #7
0
def cli(config):
    _configure_logging()

    config = yaml.load(config)

    for plugin_config in config['plugins']:
        plugin_config['redis'] = config['redis']
        _launch(plugin_config['type'], plugin_config, False)

    sleep(3)  # wait for plugins to subscribe to queues

    from triviabot.daemon import Daemon
    core_config = config['core']
    core_config['redis'] = config['redis']
    daemon = Daemon(core_config)

    p = Process(target=daemon.run)
    p.daemon = True
    p.run()

    while True:
        sleep(1)
コード例 #8
0
ファイル: main.py プロジェクト: 535521469/crawl_free_ip_proxy
def build_process(target):
    f51fp = Process(target=target, name=target.__name__)
    f51fp.daemon = 1
    f51fp.start()
    return f51fp
コード例 #9
0
ファイル: slave.py プロジェクト: 535521469/validproxy
def build_process(target):
    f51fp = Process(target=target, name=target.__name__)
    f51fp.daemon = 1
    f51fp.start()
    return f51fp