Пример #1
0
def stop_cdvr_simulator():
    with cd(cdvr_simulator_dir):
        try:
            fab_util.fab_run_command("java -version", warn_only=False)
            fab_util.fab_run_command("./shutdown.sh")
        except:
            print red('stop cdvr simulator failed. %s' % (cdvr_simulator_dir))
Пример #2
0
 def clean_log_file(*args, **kwargs):
     if clean:
         fab_util.fab_run_command('rm -rf %s/*' % (log_dir),
                                  is_local,
                                  pty=False,
                                  warn_only=True)
     return f(*args, **kwargs)
Пример #3
0
def setup_vod_simulator_ad_insertion():
    with cd(vod_simulator_dir + os.sep + 'script'):
        try:
            fab_util.fab_run_command('./setupVODAds.sh', warn_only=False)
        except:
            print red('setup vod simulator ad insertion failed. %s' %
                      (vod_simulator_dir + os.sep + 'script'))
            exit(1)
Пример #4
0
def stop_cns_simulator():
    with cd(cns_simulator_dir):
        try:
            fab_util.fab_run_command("java -version")
            fab_util.fab_run_command("./shutdown.sh")
        except:
            print red('stop cns simulator failed. %s' % (cns_simulator_dir))
            exit(1)
Пример #5
0
def setup_ads_simulator_response_template():
    with cd(ads_simulator_dir + os.sep + 'script'):
        try:
            fab_util.fab_run_command('./setup_vod_ad_response_template.sh')
        except:
            print red('setup vod response failed. %s' %
                      (ads_simulator_dir + os.sep + 'script'))
            exit(1)
Пример #6
0
def batch_stop_origin_proxy_simulator():
    with cd(origin_proxy_batch_dir):
        try:
            fab_util.fab_run_command("java -version", warn_only=True)
            fab_util.fab_run_command("./shutdown_origin_proxys.sh", timeout=20)
        except:
            print red('batch stop origin proxy simulator failed. %s' %
                      (origin_proxy_batch_dir))
            exit(1)
Пример #7
0
def stop_origin_proxy_simulator():
    with cd(origin_proxy_dir):
        try:
            fab_util.fab_run_command("java -version", warn_only=False)
            fab_util.fab_run_command("./shutdown.sh")
        except:
            print red('stop origin proxy simulator failed. %s' %
                      (origin_proxy_dir))
            exit(1)
Пример #8
0
def setup_cdvr_simulator_ad_insertion():
    with cd(cdvr_simulator_dir + os.sep + 'script'):
        try:
            fab_util.fab_run_command('./setupAdSegments.sh', warn_only=False)
            time.sleep(4)
            fab_util.fab_run_command('./getHotRecording.sh', warn_only=False)
        except:
            print red('setup cdvr simulator ad insertion failed. %s' %
                      (cdvr_simulator_dir + os.sep + 'script'))
            exit(1)
Пример #9
0
def setup_linear_ad_insertion():
    with cd(linear_ad_insertion_script_dir):
        try:
            fab_util.fab_run_command('./setup_linear_ad_segments_multi.sh',
                                     warn_only=False)
        except:
            print red('Failed to setup linear ad insertion. %s' %
                      (linear_ad_insertion_script_dir + os.sep +
                       'setup_linear_ad_segments_multi.sh'))
            exit(1)
Пример #10
0
def start_ads_simulator():
    with cd(ads_simulator_dir):
        try:
            fab_util.fab_run_command("java -version")
            fab_util.fab_run_command("nohup ./run.sh &")
        except Exception, e:
            print e
            print red('start ads simulator failed. %s' % (ads_simulator_dir))
            exit(1)
        else:
Пример #11
0
def stop_content_router_simulator():
    content_router_simulator_dir_list = content_router_simulator_dir.split(',')
    for one_content_router_simulator_dir in content_router_simulator_dir_list:
        with cd(one_content_router_simulator_dir):
            try:
                fab_util.fab_run_command("java -version")
                fab_util.fab_run_command("./shutdown.sh")
            except Exception, e:
                print red('stop content router simulator failed. %s.%s' %
                          (one_content_router_simulator_dir, str(e)))
                exit(1)
Пример #12
0
def start_ecc_spark():
    try:
        fab_util.fab_run_command(constant.SPARK_COMMAND_START,
                                 warn_only=True,
                                 timeout=20)
        time.sleep(4)
        fab_util.fab_run_command('su - spark -c "ps -ef | grep java" ',
                                 warn_only=False)
    except Exception, e:
        print red('start spark failed ,%s' % (str(e)))
        exit(1)
Пример #13
0
def setup_content_router_playlist_redirect_rule():
    content_router_simulator_dir_list = content_router_simulator_dir.split(',')
    for one_content_router_simulator_dir in content_router_simulator_dir_list:
        with cd(one_content_router_simulator_dir + os.sep + 'script'):
            try:
                fab_util.fab_run_command('./setup_playlist_redirect_rule.sh',
                                         warn_only=False)
            except:
                print red(
                    'setup playlist redirect rule failed. %s' %
                    (one_content_router_simulator_dir + os.sep + 'script'))
                exit(1)
Пример #14
0
def _fab_start_server(server_name,
                      command=None,
                      is_local=False,
                      warn_only=True):
    cmd = command or 'service %s start'
    command_line = cmd % (server_name)

    print 'Start %s server by command %s......' % (server_name, command_line)
    fab_util.fab_run_command(command_line,
                             is_local,
                             warn_only=warn_only,
                             ex_abort=True)
Пример #15
0
def start_cns_simulator():
    with cd(cns_simulator_dir):
        try:
            fab_util.fab_run_command("java -version")
            fab_util.fab_run_command("nohup ./run.sh &")
        except:
            print red('start cns simulator failed. %s' % (cns_simulator_dir))
            exit(1)
        else:
            time.sleep(2)
            fab_util.fab_run_command("netstat -an | grep 80", warn_only=False)
Пример #16
0
def start_origin_proxy_simulator():
    with cd(origin_proxy_dir):
        try:
            fab_util.fab_run_command("java -version", warn_only=True)
            fab_util.fab_run_command("nohup ./run.sh &", timeout=20)
        except:
            print red('start origin proxy simulator failed. %s' %
                      (origin_proxy_dir))
            exit(1)
        else:
            time.sleep(2)
            fab_util.fab_run_command("netstat -an | grep 80", warn_only=False)
Пример #17
0
def batch_start_origin_proxy_simulator():
    with cd(origin_proxy_batch_dir):
        try:
            fab_util.fab_run_command("java -version", warn_only=False)
            fab_util.fab_run_command("./start_up_origin_proxys.sh",
                                     timeout=20,
                                     warn_only=False)
        except:
            print red('batch start origin proxy simulator failed. %s' %
                      (origin_proxy_batch_dir))
            exit(1)
        else:
            time.sleep(2)
            fab_util.fab_run_command("netstat -an | grep 81", warn_only=False)
Пример #18
0
def start_content_router_simulator():
    content_router_simulator_dir_list = content_router_simulator_dir.split(',')
    for one_content_router_simulator_dir in content_router_simulator_dir_list:
        with cd(one_content_router_simulator_dir):
            try:
                fab_util.fab_run_command("java -version")
                fab_util.fab_run_command("nohup ./run.sh &")
            except Exception, e:
                print e
                print red('start content router simulator failed. %s' %
                          (one_content_router_simulator_dir))
                exit(1)
            else:
                time.sleep(2)
                fab_util.fab_run_command("netstat -an | grep 80",
                                         warn_only=False)
Пример #19
0
@task
@parallel
@roles('ads_simulator')
def start_ads_simulator():
    with cd(ads_simulator_dir):
        try:
            fab_util.fab_run_command("java -version")
            fab_util.fab_run_command("nohup ./run.sh &")
        except Exception, e:
            print e
            print red('start ads simulator failed. %s' % (ads_simulator_dir))
            exit(1)
        else:
            time.sleep(2)
            fab_util.fab_run_command("netstat -an | grep 8088",
                                     warn_only=False)


@task
@parallel
@roles('ads_simulator')
def setup_ads_simulator_response_template():
    with cd(ads_simulator_dir + os.sep + 'script'):
        try:
            fab_util.fab_run_command('./setup_vod_ad_response_template.sh')
        except:
            print red('setup vod response failed. %s' %
                      (ads_simulator_dir + os.sep + 'script'))
            exit(1)

Пример #20
0
def run_mongo_script():
    try:
        fab_util.fab_run_command('mongo %s' % (mongo_script), warn_only=False)
    except Exception, e:
        print red('run mongo script failed ,%s' % (str(e)))
        exit(1)
Пример #21
0
def start_redis_service():
    fab_util.fab_run_command('mkdir -p /var/run/redis')
    fab_util.fab_run_command('chown -R redis:redis /var/run/redis')
    fab_util.fab_run_command('systemctl start redis.service')
Пример #22
0
def rm_redis_cached_file():
    fab_util.fab_run_command('rm -rf %s' % (redis_db_file))
Пример #23
0
def stop_redis_service():
    fab_util.fab_run_command('systemctl stop redis.service')
Пример #24
0
def stop_ecc_spark():
    try:
        fab_util.fab_run_command(constant.SPARK_COMMAND_STOP, warn_only=True)
    except Exception, e:
        print red('start spark failed ,%s' % (str(e)))
        exit(1)