Exemplo n.º 1
0
                   "sed -i \"s/port 6379/port {communication_port}/\" \
                   redis.conf && "
                   "sed -i \"s/bind 127.0.0.1/bind {application_host_ip}/\" \
                   redis.conf ".format(communication_port=communication_port,
                                       application_host_ip=application_host_ip
                                       ))]

volume_prep_config = {
    "name": "shared-data",
    "mountPath": "/prep_config"
}

initContainer = {
    "name": "prep-config",
    "image": image_name,
    "securityContext": securityContext,
    "command": cmdline_config,
    "volumeMounts": [
        volume_prep_config
    ]
}
initContainers.append(initContainer)


volumeMounts.append(volume_prep_config)

command.append("taskset -c {} redis-server /prep_config/redis.conf".format(cpu_list))

json_format = json.dumps(pod)
print(json_format)
Exemplo n.º 2
0
# For testing purpose set to small number as 1000
number_of_rows = 100000

wait_for_cassandra_cmd = ["sh", "-c", """
          until nc -vz {cassandra_address} {communication_port}; do
            echo "$(date) Waiting for cassandra to initialize itself."
            sleep 3
          done""".format(cassandra_address=application_host_ip,
                         communication_port=communication_port)]

wait_for_cassandra_container = {
    "name": "wait-for-cassandra",
    "image": image_name + ':' + image_tag,
    "securityContext": securityContext,
    "command": wait_for_cassandra_cmd}
initContainers.append(wait_for_cassandra_container)

cassandra_warmup_cmd = ['sh', '-c',
                        'cassandra-stress write n={} \
                        -node {} -port native={} -rate threads=14'.format(
                            number_of_rows,
                            application_host_ip,
                            communication_port)]

cassandra_warmup_container = {
    "name": "cassandra-warmuper",
    "image": image_name + ':' + image_tag,
    "securityContext": securityContext,
    "command": cassandra_warmup_cmd}
initContainers.append(cassandra_warmup_container)
Exemplo n.º 3
0
mutilate_scan = bool(os.environ.get('mutilate_scan') or False)
# ----------------------------------------------------------------------------------------------------

mutilate_warmup_cmd = [
    "sh", "-c", """/mutilate/mutilate -s {}:{} --time={} \
-R 40000 --update=1 --threads=4 -C 4""".format(application_host_ip,
                                               communication_port, warmup_time)
]

mutilate_warmup_container = {
    "name": "mutilate-warmup",
    "image": image_name + ":" + image_tag,
    "securityContext": securityContext,
    "command": mutilate_warmup_cmd
}
initContainers.append(mutilate_warmup_container)

if mutilate_scan:
    mutilate_cmd = """ \"while true; do /mutilate/mutilate -s {}:{} \
    --scan {}:{}:0 --time={} --update=0.01 --threads={} -c {}; done\" """.format(
        application_host_ip, communication_port, qps, qps, time, threads,
        connections)
else:
    mutilate_cmd = """ \"while true; do /mutilate/mutilate -s {}:{} \
    -Q {} --time={} --update=0.01 --threads={} -c {}; done\" """.format(
        application_host_ip, communication_port, qps, time, threads,
        connections)

mutilate_run_cmd = """/usr/bin/mutilate_wrapper.pex --command '{mutilate_cmd}' \
--metric_name_prefix {metric_name_prefix} \
--stderr 0 --kafka_brokers '{kafka_brokers}' --kafka_topic {kafka_topic} \
    java -Xms4g -Xmx4g -Xmn2g -XX:-UseBiasedLocking -XX:+UseParallelOldGC \
    -jar {jar} -m backend -p {config} -G GRP1 -J JVM_A"""\
    .format(cpu_list=cpu_list, jar=specjbb_jar, config=config_path)

volume_prep_config = {
    "name": "shared-data",
    "mountPath": "/prep_config"
}

prepare_config_container = {
    "name": "prep-config",
    "image": image_name + ":" + image_tag,
    "securityContext": securityContext,
    "command": config_create_cmd,
    "volumeMounts": [
        volume_prep_config
    ]
}
initContainers.append(prepare_config_container)
volumeMounts.append(volume_prep_config)

if component_type == 'controller':
    command.append(controller_cmd)
elif component_type == 'injector':
    command.append(injector_cmd)
elif component_type == 'backend':
    command.append(backend_cmd)

json_format = json.dumps(pod)
print(json_format)
Exemplo n.º 5
0
Arquivo: ycsb.py Projeto: Damenus/owca
wait_for_cassandra_cmd = [
    "sh", "-c", """
          until nc -vz {cassandra_address} {communication_port}; do
            echo "$(date) Waiting for cassandra to initialize itself."
            sleep 3
          done""".format(cassandra_address=application_host_ip,
                         communication_port=communication_port)
]

wait_for_cassandra_container = {
    "name": "ycsb-wait-for-cassandra",
    "image": image_name + ':' + image_tag,
    "securityContext": securityContext,
    "command": wait_for_cassandra_cmd
}
initContainers.append(wait_for_cassandra_container)

create_structure_cmd = [
    "sh", "-c", """
            cqlsh --cqlversion 3.4.4 -e \
                "create keyspace ycsb WITH REPLICATION = {{
                'class' : 'SimpleStrategy', 'replication_factor': 1
                }};" \
                {cassandra_address} {communication_port} || true
            cqlsh --cqlversion 3.4.4 -k ycsb -e \
                "create table usertable (y_id varchar primary key,
                field0 varchar, field1 varchar, field2 varchar,
                field3 varchar, field4 varchar, field5 varchar,
                field6 varchar, field7 varchar, field8 varchar,
                field9 varchar);" \
                {cassandra_address} {communication_port} || true