Beispiel #1
0
def start(view=None):
    """start the celery server

    :param: if view is set to any value start also rabit and attach
            to it so we can see the log
    """
    # pprint (fabric.state.output)
    with settings(warn_only=True):
        stop()
        time.sleep(2)
        PROGRESS.next()
        mq.start()
        PROGRESS.next()
        time.sleep(2)
        PROGRESS.next()

        for worker in workers:
            PROGRESS.next()
            concurrency = None
            if "concurrency" in workers[worker]:
                concurrency = workers[worker]["concurrency"]
            # print worker, ":   ", str(workers[worker])
            celery_command("start",
                           workers[worker]["app"],
                           workers[worker]["hostlist"],
                           workers[worker]["queue"],
                           concurrency=concurrency)

    if view is None:
        PROGRESS.next()
        time.sleep(2)
        print
Beispiel #2
0
def execute_command(msg, command, debug):
    _capture = not debug
    if debug:
        banner(msg, debug=debug)
    else:
        PROGRESS.next()
    local(command, capture=_capture)
Beispiel #3
0
def execute_command(msg, command, debug):
    _capture = not debug
    if debug:
        banner(msg, debug=debug)
    else:
        PROGRESS.next()
    local(command, capture=_capture)
Beispiel #4
0
def start(view=None):
    """start the celery server

    :param: if view is set to any value start also rabit and attach
            to it so we can see the log
    """
    # pprint (fabric.state.output)
    with settings(warn_only=True):
        stop()
        time.sleep(2)
        PROGRESS.next()
        mq.start()
        PROGRESS.next()
        time.sleep(2)
        PROGRESS.next()

        for worker in workers:
            PROGRESS.next()
            concurrency = None
            if "concurrency" in workers[worker]:
                concurrency = workers[worker]["concurrency"]
            # print worker, ":   ", str(workers[worker])
            celery_command("start", workers[worker]["app"],
                           workers[worker]["hostlist"], workers[
                               worker]["queue"],
                           concurrency=concurrency)

    if view is None:
        PROGRESS.next()
        time.sleep(2)
        print
Beispiel #5
0
def simple():
    '''
    puts a snapshot of servers, images, and flavors into mongo (no users)
    '''
    refresh(types=['servers', 'images', 'flavors'])
    PROGRESS.next()
    print
    inventory()
    PROGRESS.next()
    print
Beispiel #6
0
def simple():
    """
    puts a snapshot of servers, images, and flavors into mongo (no users)
    """
    refresh(types=['servers', 'images', 'flavors'])
    PROGRESS.next()
    print
    inventory()
    PROGRESS.next()
    print
Beispiel #7
0
def reset(password=None):
    banner("initiating mongo")
    boot()
    banner("initiating user data to mongo")
    PROGRESS.next()
    print
    if password is None:
        local("fab user.mongo")
    else:
        local("fab user.mongo:passwd={0}".format(password))
    PROGRESS.next()
    banner("refreshing cloud info")
    simple()
Beispiel #8
0
def start(detached=None):
    """start the rabbit mq server"""
    if PRODUCTION:
        print "Run '/etc/init.d/rabbitmq-server start' to start server"
        while not yn_choice("Is rabbitmq running?", 'n'):
            print "Please start rabbitmq-server."
    else:
        PROGRESS.next()
        print
        if detached is None:
            rabbit_env['detached'] = "-detached"
        # log.info (rabbit_env)
        local("{rabbitmq_server} {detached}".format(**rabbit_env))
Beispiel #9
0
def start(detached=None):
    """start the rabbit mq server"""
    if PRODUCTION:
        print "Run '/etc/init.d/rabbitmq-server start' to start server"
        while not yn_choice("Is rabbitmq running?", 'n'):
            print "Please start rabbitmq-server."
    else:
        PROGRESS.next()
        print
        if detached is None:
            rabbit_env['detached'] = "-detached"
        # log.info (rabbit_env)
        local("{rabbitmq_server} {detached}".format(**rabbit_env))
Beispiel #10
0
def celery_command(command, app, workers, queue, concurrency=None):
    """execute the celery command on the application and workers specified"""
    PROGRESS.next()
    worker_str = " ".join(workers)
    exec_string = "celery multi {0} {1} -A {2} -l info -Q {3}".format(
        command, worker_str, app, queue)
    # directories for log and pid file
    celery_dir = "celery"
    local("mkdir -p %s" % celery_dir)
    exec_string += " --pidfile=\"{0}/%n.pid\" ".format(celery_dir)
    exec_string += " --logfile=\"{0}/%n.log\" ".format(celery_dir)
    if concurrency is not None:
        exec_string += " --concurrency={0}".format(concurrency)
    local(exec_string, capture=not debug)
Beispiel #11
0
def celery_command(command, app, workers, queue, concurrency=None):
    """execute the celery command on the application and workers specified"""
    PROGRESS.next()
    worker_str = " ".join(workers)
    exec_string = "celery multi {0} {1} -A {2} -l info -Q {3}".format(
        command, worker_str, app, queue)
    # directories for log and pid file
    celery_dir = "celery"
    local("mkdir -p %s" % celery_dir)
    exec_string += " --pidfile=\"{0}/%n.pid\" ".format(celery_dir)
    exec_string += " --logfile=\"{0}/%n.log\" ".format(celery_dir)
    if concurrency is not None:
        exec_string += " --concurrency={0}".format(concurrency)
    local(exec_string, capture=not debug)
Beispiel #12
0
def start(server="server", browser='yes', debug=False):
    """ starts in dir webgui the program server.py and displays a browser on the given port and link"""

    # pprint (fabric.state.output)

    """
        'aborts': True,
        'debug': False,
        'running': True,
        'status': True,
        'stderr': True,
        'stdout': True,
        'user': True,
        'warnings': True
        }
    """
    # banner(debug)

    banner("KILL THE SERVER", debug=debug)
    kill(debug=debug)
    if not debug:
        PROGRESS.next()

    execute_command("INSTALL CLOUDMESH",
                    "python setup.py install",
                    debug=debug)

    mongo.start()
    # execute_command("START MONGO",
    # "fab mongo.start",
    #            debug)

    queue.start()
    # execute_command("START RABITMQ",
    #        "fab queue.start", debug)

    queue.flower_server()
    # execute_command("START FLOWER",
    #        "fab queue.flower_server",
    #        debug)
    fabric.state.output.stdout = True
    fabric.state.output.stderr = True
    execute_command("START WEB SERVER",
                    "cd cloudmesh_web; python {0}.py &".format(server),
                    True)
    # view(link)
    PROGRESS.finish()
Beispiel #13
0
def start(server="server", browser='yes', debug=False):
    """ starts in dir webgui the program server.py and displays a browser on the given port and link"""

    # pprint (fabric.state.output)
    """
        'aborts': True,
        'debug': False,
        'running': True,
        'status': True,
        'stderr': True,
        'stdout': True,
        'user': True,
        'warnings': True
        }
    """
    # banner(debug)

    banner("KILL THE SERVER", debug=debug)
    kill(debug=debug)
    if not debug:
        PROGRESS.next()

    execute_command("INSTALL CLOUDMESH",
                    "python setup.py install",
                    debug=debug)

    mongo.start()
    # execute_command("START MONGO",
    #            "fab mongo.start",
    #            debug)

    queue.start()
    # execute_command("START RABITMQ",
    #        "fab queue.start", debug)

    queue.flower_server()
    # execute_command("START FLOWER",
    #        "fab queue.flower_server",
    #        debug)
    fabric.state.output.stdout = True
    fabric.state.output.stderr = True
    execute_command("START WEB SERVER",
                    "cd cloudmesh_web; python {0}.py &".format(server), True)
    # view(link)
    PROGRESS.finish()
Beispiel #14
0
def boot(auth=True):

    # wipe mongo
    wipe()

    time.sleep(1)
    PROGRESS.next()
    # start mongo without auth
    start(auth=False)

    time.sleep(5)
    PROGRESS.next()
    if isyes(auth):

        # create users
        admin()

        time.sleep(2)
        PROGRESS.next()
        # restart with auth
        kill()

        time.sleep(10)
        PROGRESS.next()
        start(auth=auth)

        time.sleep(1)
        PROGRESS.next()
    config = cm_config_server().get("cloudmesh.server.mongo")
    path = path_expand(config["path"])
    banner(path)
    print ls(path)
    banner("PROCESS")
    with settings(warn_only=True):
        local("ps -ax | fgrep mongo")
    PROGRESS.next()
Beispiel #15
0
def boot(auth=True):
    # wipe mongo
    wipe()

    time.sleep(1)
    PROGRESS.next()
    # start mongo without auth
    start(auth=False)

    time.sleep(5)
    PROGRESS.next()
    if isyes(auth):
        # create users
        admin()

        time.sleep(2)
        PROGRESS.next()
        # restart with auth
        kill()

        time.sleep(10)
        PROGRESS.next()
        start(auth=auth)

        time.sleep(1)
        PROGRESS.next()
    config = cm_config_server().get("cloudmesh.server.mongo")
    path = path_expand(config["path"])
    banner(path)
    print Shell.ls(path)
    banner("PROCESS")
    with settings(warn_only=True):
        local("ps -ax | fgrep mongo")
    PROGRESS.next()