예제 #1
0
    platform_name = ""
    try:
        import platform
        platform_name = platform.system()
    except ImportError, ie:
        platform_name = "Windows"

    from functhread import FuncThread
        
    server_instances = {}
    # List of server instances running
    for s in server_list:
        process_id = ""
        if platform_name == "Windows":
            p = FuncThread(s.run)
            process_id = p.name
        else:
            p = multiprocessing.Process(target=s.run)
            process_id = p.pid
        p.start()
        server_instances[process_id] = {'Process': p, 'ServerObject': s}

    if args.waitress:
        # TODO: make waitress use multiprocessing
        pass
        import waitress

        host = configuration.get_config_value('wps', 'serveraddress').split('://')[1]
        port = int(configuration.get_config_value('wps', 'serverport'))
예제 #2
0
                            try:
                                v = eval(par['value'])
                            except:
                                v = par['value']
                            par['value'] = v
                    dic_param[str(par['name'])] = par['value']
                #print('dic_param ' + str(dic_param))

                for i in fun['out_cv']:
                    #print('map',str(fun['id']),str(i))
                    #map_queue[str(fun['id']),str(i)] = queue.Queue()
                    MapQueue.queues[str(fun['id']), str(i)] = queue.Queue()

                t = FuncThread(target=eval(fun['name']),
                               kwargs=dic_param,
                               in_cv_q=fun['in_cv'],
                               out_cv_q=fun['out_cv'],
                               uid=fun['id'])
                #print(fun['level'])
                thread_queue.put(Job(fun['level'], t))

        if not os.path.exists('/tmp/images'):
            os.makedirs('/tmp/images')

        dtime = {}
        while not thread_queue.empty():
            t = thread_queue.get()
            t.thread.start()
            t.thread.join()
            dtime[t.thread.uid] = t.thread.time