예제 #1
0
def cli(host, port):
    Socket_client.set_host(host)
    Socket_client.set_port(port)
    click.echo('Connecting %s:%s ...' % (host, port))

    monkey.patch_all()

    while True:
        joins = []
        gevent_id = 0  # 作为 gevent 的ID标识
        for project in load_projects():
            gevent_id += 1
            joins.append(gevent.spawn(run, gevent_id, project['name'], project['code'], project['init_url']))
            #
            # gevent_id += 1
            # joins.append(gevent.spawn(run, gevent_id, project['name'], project['code'], project['init_url']))

        gevent.joinall(joins)
        print click.echo('重启中......')
예제 #2
0
def init():
    try:
        json_string = Socket_client.run(json.dumps({'init': 1}))
        return json.loads(json_string)
    except:
        return None