def deploy_project(user = None, passwd = None, http = True): ''' If `user` and/or `passwd` given, use them to authenticate when cloning via http. If not `http` clone via normal git url. ''' # bool casting http = FabUtil.str2bool(http) with settings(warn_only=True): # only clone if dir not already exists if run("test -d %s" % CODE_DIR).failed: git_url = FabUtil.build_git_http_url(user, passwd) if http else REPO_PATH_GIT_URL run("git clone %s" % git_url) # update repository with cd(CODE_DIR): run("git pull")
def deploy_project(user=None, passwd=None, http=True): ''' If `user` and/or `passwd` given, use them to authenticate when cloning via http. If not `http` clone via normal git url. ''' # bool casting http = FabUtil.str2bool(http) with settings(warn_only=True): # only clone if dir not already exists if run("test -d %s" % CODE_DIR).failed: git_url = FabUtil.build_git_http_url( user, passwd) if http else REPO_PATH_GIT_URL run("git clone %s" % git_url) # update repository with cd(CODE_DIR): run("git pull")
def start_workers(concurrency=None, autoscale = False, autoscale_mult = None): ''' Start workers on registered hosts with specified concurrency. Parameters ---------- concurrency : int autoscale : bool, optional (default is True) autoscale_mult : int, optional (default is 2) concurrency * autoscale_mult is maximum number of processes. See Also -------- http://celery.readthedocs.org/en/latest/reference/celery.bin.multi.html ''' print "starting workers: %s" % hosts_str setup_celery_dir() with cd(CODE_DIR): run("%s multi start %s" % (FabUtil.get_celery_command(), FabUtil.build_celery_opts(concurrency, autoscale=autoscale, autoscale_mult=autoscale_mult)))
def stop_workers(signal=signal.SIGTERM): ''' Stop all workers. Parameters ---------- signal : optional, default is (signal.SIGTERM) ''' print "stopping workers: %s" % hosts_str run("%s multi stop %s -%s --pidfile=%s" % (FabUtil.get_celery_command(), WORKER_NAME, signal, PID_FILE))
def start_workers(concurrency=None, autoscale=False, autoscale_mult=None): ''' Start workers on registered hosts with specified concurrency. Parameters ---------- concurrency : int autoscale : bool, optional (default is True) autoscale_mult : int, optional (default is 2) concurrency * autoscale_mult is maximum number of processes. See Also -------- http://celery.readthedocs.org/en/latest/reference/celery.bin.multi.html ''' print "starting workers: %s" % hosts_str setup_celery_dir() with cd(CODE_DIR): run("%s multi start %s" % (FabUtil.get_celery_command(), FabUtil.build_celery_opts(concurrency, autoscale=autoscale, autoscale_mult=autoscale_mult)))
def start_workers(concurrency=cpu_count(), autoscale = False, autoscale_mult = None): ''' Start workers on registered hosts with specified concurrency. Parameters ---------- concurrency : int autoscale : bool, optional (default is True) autoscale_mult : int, optional (default is 2) concurrency * autoscale_mult is maximum number of processes. See Also -------- http://celery.readthedocs.org/en/latest/reference/celery.bin.multi.html ''' run("rm -r %s" % LOG_FILE) run("mkdir -p /tmp/celery/") run("%s worker %s" % (get_celery_command(), FabUtil.build_celery_opts(concurrency, worker_name = "", autoscale=autoscale, autoscale_mult=autoscale_mult, # log to stdout log_file=None)))