enable ci script in rpc mode

Change-Id: I66dacfe2f48cd1484350e28bbb9ed9652b363ce8
This commit is contained in:
Kun Huang 2015-11-11 14:19:29 +08:00
parent 7183ec5f4d
commit 1c26de127b
5 changed files with 27 additions and 14 deletions

View File

@ -16,6 +16,15 @@ function init_scalpels {
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 {
echo "nothing need config now."
}
@ -85,12 +94,13 @@ if is_service_enabled scalpels; then
# Initialize and start the scalpels service
echo_summary "Initializing scalpels"
init_scalpels
start_scalpels
fi
if [[ "$1" == "unstack" ]]; then
# Shut down scalpels services
# no-op
:
stop_scalpels
fi
if [[ "$1" == "clean" ]]; then

View File

@ -23,8 +23,8 @@ class TraceEndpoint(object):
def tracer_list(self, ctx):
# TODO db_api
# XXX ctx required?
from scalpels.client.utils import traces_map
return traces_map
from scalpels.client.utils import tracers_map
return tracers_map
def start_tracers(self, ctx, tracers):
task = db_api.task_create(results=[], pids=[])
@ -78,6 +78,7 @@ class ResultEndpoint(object):
"name":ret.name,
"unit":ret.unit,
"data":ret.data,
"rtype":ret.rtype,
}
def get_all_results(self, ctx):
@ -88,7 +89,8 @@ class ResultEndpoint(object):
"uuid":ret.uuid,
"name":ret.name,
"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)
target = oslo_messaging.Target(topic='test', server='localhost')

View File

@ -2,7 +2,9 @@
#-*- coding:utf-8 -*-
# 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
def run(config):
@ -15,15 +17,15 @@ def run(config):
if config.get("list"):
rets = agent_api.get_all_results()
if config.get("html"):
report.generate_multiple_result_html(rets)
generate_multiple_result_html(rets)
elif config.get("short"):
for ret in rets:
print ret.uuid
print ret["uuid"]
else:
map(report.pprint_result, rets)
map(pprint_result, rets)
elif config.get("uuid"):
ret = agent_api.get_result(config["uuid"])
if config.get("html"):
report.generate_result_html(ret)
generate_result_html(ret)
else:
report.pprint_result(ret)
pprint_result(ret)

View File

@ -24,11 +24,11 @@ tracers_map = {
def generate_result_html(result):
if result.rtype == "stream":
if result["rtype"] == "stream":
tmpl_dir = os.path.dirname(templates.__file__)
lookup = TemplateLookup(directories=[tmpl_dir])
t = lookup.get_template("line-chart.mako")
print t.render(**result.__dict__)
print t.render(**result)
def generate_multiple_result_html(results):
tmpl_dir = os.path.dirname(templates.__file__)

View File

@ -2,7 +2,6 @@
# Author: Kun Huang <academicgareth@gmail.com>
echo "Hello, scalpels ci"
sca setup -d /opt/stack/data/scalpels/scripts
source /opt/stack/new/devstack/openrc admin admin
function debug_msg {
@ -13,7 +12,7 @@ function debug_msg {
}
function basic_test {
sca agent -l
sca tracer -l
sca start -a rpc -a rabbit -a traffic
sca load --storm