def activate_controller(): if is_running(local, 'ipcontroller'): return log.info(blue('Running ipcontroller on local machine')) with hide('output'): #local('ipcontroller --reuse --ip={} &'.format( local('ipcontroller --ip={} &'.format( utils.get_local_ip(public=False))) #FIXME env.host=localhost time.sleep(2) for target_ip in env.hosts: if target_ip == utils.get_local_ip(): local('cp {} /home/{}/dev/'.format(ENGINES_PATH, env.user)) else: local('scp {} {}@{}:dev/'.format(ENGINES_PATH, env.user, target_ip))
def activate_monitoring(): log.info(blue('Running glances in server mode on %(host)s' % env)) if env.host == utils.get_local_ip(): if not is_running(local, 'glances'): local('glances -s &') else: if not is_running(run, 'glances'): run('glances -s &', pty=False)
def activate_node(): log.info(blue('Running an ipengine on node %(host)s' % env)) #NOTE In local do something with ipcluster ? with hide('output'): if env.host == utils.get_local_ip(): local('ipengine --file=/home/{}/dev/ipcontroller-engine.json'.format(env.user)) else: run('ipengine --file=/home/{}/dev/ipcontroller-engine.json'.format(env.user), pty=False)
def update_git_repos(): project = 'ppQuanTrade' #TODO use setup.py instead #TODO More generic command log.info(blue('Updating remote version of ppQuanTrade %(host)s' % env)) run('cd /home/xavier/dev/projects/{} && \ git pull xavier@{}:dev/projects/{}'.format( project, utils.get_local_ip(public=False), project)) sudo('cp -r /home/xavier/dev/projects/ppQuanTrade/neuronquant/ \ /usr/local/lib/python2.7/dist-packages/')
def activate_node(): log.info(blue('Running an ipengine on node %(host)s' % env)) #NOTE In local do something with ipcluster ? with hide('output'): if env.host == utils.get_local_ip(): local( 'ipengine --file=/home/{}/dev/ipcontroller-engine.json'.format( env.user)) else: run('ipengine --file=/home/{}/dev/ipcontroller-engine.json'.format( env.user), pty=False)
def activate_restserver(): #print("Executing on %(host)s as %(user)s" % env) #env.host_string = env.host log.info(blue('Waking up REST server on %(host)s' % env)) #with hide('output'): with shell_env(NODE_PATH=NODE_PATH, NODE_CONFIG_DIR=NODE_CONFIG): if env.host == utils.get_local_ip(): if not is_running(local, 'rest_server'): local('node {} &'.format(RESTSERVER_PATH)) else: if not is_running(run, 'rest_server'): run('node {} &'.format(RESTSERVER_PATH), pty=False)