Hi,
I use the VirtualEnv to install Rally and the version is 1.0.0
, the source code locates at ./lib/python3.4/site-packages/esrally
.
In the ./metrics.py
, I found the code that index the result to ES, So I set a breaking point:
class EsResultsStore:
"""
Stores the results of a race in a format that is better suited for reporting with Kibana.
"""
INDEX_PREFIX = "rally-results-"
RESULTS_DOC_TYPE = "results"
def __init__(self, cfg, client_factory_class=EsClientFactory, index_template_provider_class=IndexTemplateProvider):
"""
Creates a new results store.
:param cfg: The config object. Mandatory.
:param client_factory_class: This parameter is optional and needed for testing.
:param index_template_provider_class: This parameter is optional and needed for testing.
"""
self.cfg = cfg
self.trial_timestamp = cfg.opts("system", "time.start")
self.client = client_factory_class(cfg).create()
self.index_template_provider = index_template_provider_class(cfg)
def store_results(self, race):
# always update the mapping to the latest version
import pdb
pdb.set_trtace()
self.client.put_template("rally-results", self.index_template_provider.results_template())
self.client.bulk_index(index=self.index_name(), doc_type=EsResultsStore.RESULTS_DOC_TYPE, items=race.to_result_dicts())
def index_name(self):
return "%s%04d-%02d" % (EsResultsStore.INDEX_PREFIX, self.trial_timestamp.year, self.trial_timestamp.month)
it does not reach this step, but the summary report has been indexed into ES.
And then,In the ./racecontrol.py
, I found that you use the godaddy/Thespian
to achieve the actor model. I also set a breaking point:
def race(cfg, sources=False, build=False, distribution=False, external=False, docker=False):
logger = logging.getLogger(__name__)
# at this point an actor system has to run and we should only join
actor_system = actor.bootstrap_actor_system(try_join=True)
benchmark_actor = actor_system.createActor(BenchmarkActor, targetActorRequirements={"coordinator": True})
try:
import pdb
pdb.set_trtace()
result = actor_system.ask(benchmark_actor, Setup(cfg, sources, build, distribution, external, docker))
if isinstance(result, Success):
logger.info("Benchmark has finished successfully.")
# may happen if one of the load generators has detected that the user has cancelled the benchmark.
elif isinstance(result, actor.BenchmarkCancelled):
logger.info("User has cancelled the benchmark (detected by actor).")
elif isinstance(result, actor.BenchmarkFailure):
logger.error("A benchmark failure has occurred")
raise exceptions.RallyError(result.message, result.cause)
else:
raise exceptions.RallyError("Got an unexpected result during benchmarking: [%s]." % str(result))
except KeyboardInterrupt:
logger.info("User has cancelled the benchmark (detected by race control).")
# notify the coordinator so it can properly handle this state. Do it blocking so we don't have a race between this message
# and the actor exit request.
actor_system.ask(benchmark_actor, actor.BenchmarkCancelled())
finally:
logger.info("Telling benchmark actor to exit.")
actor_system.tell(benchmark_actor, thespian.actors.ActorExitRequest())
when I input n
in debug model, it just run and then return success!!
Can you tell me what happened? Why it seems to do not run the code that index the summary report to ES, but the report has been indexed in fact ?
Now, I want to add some key-value paris, where should I change?
Thanks!