enable ci script in rpc mode
Change-Id: I66dacfe2f48cd1484350e28bbb9ed9652b363ce8
This commit is contained in:
parent
7183ec5f4d
commit
1c26de127b
@ -16,6 +16,15 @@ function init_scalpels {
|
|||||||
install -t $SCALPELS_DATA_DIR $SCALPELS_DIR/scripts/*
|
install -t $SCALPELS_DATA_DIR $SCALPELS_DIR/scripts/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function start_scalpels {
|
||||||
|
sca-manage setup -d /opt/stack/data/scalpels/scripts
|
||||||
|
run_process scalpels "sca-agent"
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop_scalpels {
|
||||||
|
stop_process scalpels
|
||||||
|
}
|
||||||
|
|
||||||
function configure_scalpels {
|
function configure_scalpels {
|
||||||
echo "nothing need config now."
|
echo "nothing need config now."
|
||||||
}
|
}
|
||||||
@ -85,12 +94,13 @@ if is_service_enabled scalpels; then
|
|||||||
# Initialize and start the scalpels service
|
# Initialize and start the scalpels service
|
||||||
echo_summary "Initializing scalpels"
|
echo_summary "Initializing scalpels"
|
||||||
init_scalpels
|
init_scalpels
|
||||||
|
start_scalpels
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "unstack" ]]; then
|
if [[ "$1" == "unstack" ]]; then
|
||||||
# Shut down scalpels services
|
# Shut down scalpels services
|
||||||
# no-op
|
# no-op
|
||||||
:
|
stop_scalpels
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "clean" ]]; then
|
if [[ "$1" == "clean" ]]; then
|
||||||
|
@ -23,8 +23,8 @@ class TraceEndpoint(object):
|
|||||||
def tracer_list(self, ctx):
|
def tracer_list(self, ctx):
|
||||||
# TODO db_api
|
# TODO db_api
|
||||||
# XXX ctx required?
|
# XXX ctx required?
|
||||||
from scalpels.client.utils import traces_map
|
from scalpels.client.utils import tracers_map
|
||||||
return traces_map
|
return tracers_map
|
||||||
|
|
||||||
def start_tracers(self, ctx, tracers):
|
def start_tracers(self, ctx, tracers):
|
||||||
task = db_api.task_create(results=[], pids=[])
|
task = db_api.task_create(results=[], pids=[])
|
||||||
@ -78,6 +78,7 @@ class ResultEndpoint(object):
|
|||||||
"name":ret.name,
|
"name":ret.name,
|
||||||
"unit":ret.unit,
|
"unit":ret.unit,
|
||||||
"data":ret.data,
|
"data":ret.data,
|
||||||
|
"rtype":ret.rtype,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_all_results(self, ctx):
|
def get_all_results(self, ctx):
|
||||||
@ -88,7 +89,8 @@ class ResultEndpoint(object):
|
|||||||
"uuid":ret.uuid,
|
"uuid":ret.uuid,
|
||||||
"name":ret.name,
|
"name":ret.name,
|
||||||
"unit":ret.unit,
|
"unit":ret.unit,
|
||||||
"data":ret.data} for ret in rets]
|
"data":ret.data,
|
||||||
|
"rtype":ret.rtype} for ret in rets]
|
||||||
|
|
||||||
transport = oslo_messaging.get_transport(cfg.CONF)
|
transport = oslo_messaging.get_transport(cfg.CONF)
|
||||||
target = oslo_messaging.Target(topic='test', server='localhost')
|
target = oslo_messaging.Target(topic='test', server='localhost')
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
#-*- coding:utf-8 -*-
|
#-*- coding:utf-8 -*-
|
||||||
# Author: Kun Huang <academicgareth@gmail.com>
|
# Author: Kun Huang <academicgareth@gmail.com>
|
||||||
|
|
||||||
from scalpels.client.actions import report
|
from scalpels.client.utils import generate_multiple_result_html
|
||||||
|
from scalpels.client.utils import pprint_result
|
||||||
|
from scalpels.client.utils import generate_result_html
|
||||||
from scalpels.client.api import api as agent_api
|
from scalpels.client.api import api as agent_api
|
||||||
|
|
||||||
def run(config):
|
def run(config):
|
||||||
@ -15,15 +17,15 @@ def run(config):
|
|||||||
if config.get("list"):
|
if config.get("list"):
|
||||||
rets = agent_api.get_all_results()
|
rets = agent_api.get_all_results()
|
||||||
if config.get("html"):
|
if config.get("html"):
|
||||||
report.generate_multiple_result_html(rets)
|
generate_multiple_result_html(rets)
|
||||||
elif config.get("short"):
|
elif config.get("short"):
|
||||||
for ret in rets:
|
for ret in rets:
|
||||||
print ret.uuid
|
print ret["uuid"]
|
||||||
else:
|
else:
|
||||||
map(report.pprint_result, rets)
|
map(pprint_result, rets)
|
||||||
elif config.get("uuid"):
|
elif config.get("uuid"):
|
||||||
ret = agent_api.get_result(config["uuid"])
|
ret = agent_api.get_result(config["uuid"])
|
||||||
if config.get("html"):
|
if config.get("html"):
|
||||||
report.generate_result_html(ret)
|
generate_result_html(ret)
|
||||||
else:
|
else:
|
||||||
report.pprint_result(ret)
|
pprint_result(ret)
|
||||||
|
@ -24,11 +24,11 @@ tracers_map = {
|
|||||||
|
|
||||||
|
|
||||||
def generate_result_html(result):
|
def generate_result_html(result):
|
||||||
if result.rtype == "stream":
|
if result["rtype"] == "stream":
|
||||||
tmpl_dir = os.path.dirname(templates.__file__)
|
tmpl_dir = os.path.dirname(templates.__file__)
|
||||||
lookup = TemplateLookup(directories=[tmpl_dir])
|
lookup = TemplateLookup(directories=[tmpl_dir])
|
||||||
t = lookup.get_template("line-chart.mako")
|
t = lookup.get_template("line-chart.mako")
|
||||||
print t.render(**result.__dict__)
|
print t.render(**result)
|
||||||
|
|
||||||
def generate_multiple_result_html(results):
|
def generate_multiple_result_html(results):
|
||||||
tmpl_dir = os.path.dirname(templates.__file__)
|
tmpl_dir = os.path.dirname(templates.__file__)
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# Author: Kun Huang <academicgareth@gmail.com>
|
# Author: Kun Huang <academicgareth@gmail.com>
|
||||||
|
|
||||||
echo "Hello, scalpels ci"
|
echo "Hello, scalpels ci"
|
||||||
sca setup -d /opt/stack/data/scalpels/scripts
|
|
||||||
source /opt/stack/new/devstack/openrc admin admin
|
source /opt/stack/new/devstack/openrc admin admin
|
||||||
|
|
||||||
function debug_msg {
|
function debug_msg {
|
||||||
@ -13,7 +12,7 @@ function debug_msg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function basic_test {
|
function basic_test {
|
||||||
sca agent -l
|
sca tracer -l
|
||||||
sca start -a rpc -a rabbit -a traffic
|
sca start -a rpc -a rabbit -a traffic
|
||||||
|
|
||||||
sca load --storm
|
sca load --storm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user