예제 #1
0
 def rewrite_amqp(user=r"\2",
                  pw=r"\3",
                  host=r"\4",
                  port=r"\5",
                  vhost=r"\6",
                  config_path=CONFIG_PATH):
     any(
         run(r""" sed -i.bak "s/\(%s[ ]*=[ ]*amqp:[/][/]\)\(.*\)[:]\(.*\)[@]\(.*\)[:]\(.*\)[/]\(.*\)/\1%s:%s@%s:%s\/%s/g" %s """
             % (key, user, pw, host, port, vhost, config_path))
         for key in [KEY_BROKER_URL, KEY_BROKER_BACKEND_URL])
예제 #2
0
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)))
예제 #3
0
 def rewrite_amqp(user = r"\2", pw = r"\3", host = r"\4", port = r"\5", vhost = r"\6", config_path = CONFIG_PATH):
     any(
         run(r""" sed -i.bak "s/\(%s[ ]*=[ ]*amqp:[/][/]\)\(.*\)[:]\(.*\)[@]\(.*\)[:]\(.*\)[/]\(.*\)/\1%s:%s@%s:%s\/%s/g" %s """ % (key, user, pw, host, port, vhost, config_path))
         for key in [KEY_BROKER_URL, KEY_BROKER_BACKEND_URL]
     )
예제 #4
0
 def rewrite_config_key(key, value, config_path = CONFIG_PATH):
     key = key.strip()
     value = value.strip()
     return run(r""" sed -i.bak "s/\(%s[ ]*=[ ]*\).*/\1%s/g" %s """ % (key, value, config_path))
예제 #5
0
 def rewrite_config_key(key, value, config_path=CONFIG_PATH):
     key = key.strip()
     value = value.strip()
     return run(r""" sed -i.bak "s/\(%s[ ]*=[ ]*\).*/\1%s/g" %s """ %
                (key, value, config_path))