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
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
def execute_command(msg, command, debug): _capture = not debug if debug: banner(msg, debug=debug) else: PROGRESS.next() local(command, capture=_capture)
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
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
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))
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()
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)
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()
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()
# SETTING THE BROWSER BASED ON PLATFORM # web_browser = "firefox" debug = True try: debug = cm_config_server().get("cloudmesh.server.debug") except: pass if debug: progress.off() else: progress.on() PROGRESS.set('Cloudmesh Services', 50) if sys.platform == 'darwin': web_browser = "open" def execute_command(msg, command, debug): _capture = not debug if debug: banner(msg, debug=debug) else: PROGRESS.next() local(command, capture=_capture) #
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()
from cloudmesh.cm_mongo import cm_mongo from cloudmesh.config.cm_config import cm_config, cm_config_server from cloudmesh.user.cm_userLDAP import cm_userLDAP from cloudmesh.pbs.pbs_mongo import pbs_mongo from cloudmesh_install.util import path_expand from cloudmesh_install.util import banner from cloudmesh_install.util import yn_choice from cloudmesh.inventory import Inventory from sh import ls import sys import os import time from cloudmesh_common.util import PROGRESS import progress PROGRESS.set('Cloudmesh Services', 50) debug = True try: debug = cm_config_server().get("cloudmesh.server.debug") except: pass if debug: progress.off() else: progress.on() def get_pid(command): with hide('output', 'running', 'warnings'):