Example #1
0
def startWebServer():
    """ Function:       startWebServer()
        Description:    启动数据展示模块
        Input:          无
        Return:         :return :无
        Others:         无
    """
    print '准备开启数据展示模块'
    try:
        cmd = 'gnome-terminal -x bash -c "{}/web_server;exec bash;"'.format(
            os.path.abspath('.'))
        os.system(cmd)
    except Exception as error:
        try:
            import web_server
            web_server.start()

        except Exception:

            DataBase.writeLog(
                "展示模块开启失败,请检查服务器地址是否被占用:" + error,
                status='[ERROR]')
            print "展示模块开启失败,请检查服务器地址是否被占用:" + error
            global ERROR
            ERROR = True
            return
    if not ERROR:
        DataBase.writeLog('数据展示模块开启成功')
Example #2
0
def main():
    print(
        f'{"-"*30}\ncurl {REMOTE_IP}:{web_server.PORT}/deploy.sh | /bin/bash\n{"-"*30}\n'
    )
    setup_deployment()
    web_server.start(should_wait=False)
    stager.initialise()
    InstanceManager.start_worker()
    App()
    def main():
        logging.info(' ** Starting ShakeCast Web Server ** ')
        try:
            start()

        except Exception as e:
            exc_tb = sys.exc_info()[2]
            filename, line_num, func_name, text = traceback.extract_tb(
                exc_tb)[-1]
            logging.info('{}: {} - line: {}\nOriginated: {} {} {} {}'.format(
                type(e), e, exc_tb.tb_lineno, filename, line_num, func_name,
                text))
        return
    def main():
        logging.info(' ** Starting ShakeCast Web Server ** ')
        try:
            start()

        except Exception as e:
            exc_tb = sys.exc_info()[2]
            filename, line_num, func_name, text = traceback.extract_tb(exc_tb)[-1]
            logging.info('{}: {} - line: {}\nOriginated: {} {} {} {}'.format(type(e), 
                                                                             e, 
                                                                             exc_tb.tb_lineno,
                                                                             filename, 
                                                                             line_num, 
                                                                             func_name, 
                                                                             text))
        return
Example #5
0
def test_web_client():
  new_pid = os.fork()
  if new_pid == 0:
    web_server.start()
  else:
    #waiting for the web server to start
    time.sleep(5)
    web_client.set_key_value("key3","a")
    value = web_client.get_key_value("key3")
    assert(value == "a") 
    web_client.set_key_value("key3","b")
    web_client.set_key_value("key2","a")
    value = web_client.get_key_value("key3")
    assert(value == "b") 
    value = web_client.get_key_value("key2")
    assert(value == "a") 
    os.kill(new_pid, signal.SIGKILL)
Example #6
0
#!/usr/bin/env python
import os

pid = os.fork()
if pid:
    import web_server
    web_server.start()
else:
    import entity_server
    entity_server.start()

Example #7
0
# -*- coding: utf-8 -*-

import crowd_implement.crowd_system as cc
import threading
import web_server


def system_init():
    print('init system......')
    cc.system_run()


thread = threading.Thread(target=system_init)
thread.start()
web_server.start()