Merge "Refactoring task detailed command"
This commit is contained in:
commit
25d5f0e0b9
@ -290,7 +290,8 @@ class TaskCommands(object):
|
|||||||
Prints detailed information of task.
|
Prints detailed information of task.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _print_iterations_data(raw_data):
|
def _print_iterations_data(result):
|
||||||
|
raw_data = result["data"]["raw"]
|
||||||
headers = ["iteration", "full duration"]
|
headers = ["iteration", "full duration"]
|
||||||
float_cols = ["full duration"]
|
float_cols = ["full duration"]
|
||||||
atomic_actions = []
|
atomic_actions = []
|
||||||
@ -315,18 +316,14 @@ class TaskCommands(object):
|
|||||||
if r["atomic_actions"]:
|
if r["atomic_actions"]:
|
||||||
for action in atomic_actions:
|
for action in atomic_actions:
|
||||||
dlist.append(r["atomic_actions"].get(action) or 0)
|
dlist.append(r["atomic_actions"].get(action) or 0)
|
||||||
table_rows.append(rutils.Struct(**dict(zip(headers, dlist))))
|
table_rows.append(rutils.Struct(**dict(zip(headers,
|
||||||
|
dlist))))
|
||||||
cliutils.print_list(table_rows,
|
cliutils.print_list(table_rows,
|
||||||
fields=headers,
|
fields=headers,
|
||||||
formatters=formatters)
|
formatters=formatters)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
task = db.task_get_detailed(task_id)
|
def _print_task_info(task):
|
||||||
|
|
||||||
if task is None:
|
|
||||||
print("The task %s can not be found" % task_id)
|
|
||||||
return(1)
|
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("-" * 80)
|
print("-" * 80)
|
||||||
print(_("Task %(task_id)s: %(status)s")
|
print(_("Task %(task_id)s: %(status)s")
|
||||||
@ -340,13 +337,15 @@ class TaskCommands(object):
|
|||||||
print(verification[0])
|
print(verification[0])
|
||||||
print(verification[1])
|
print(verification[1])
|
||||||
print()
|
print()
|
||||||
print(_("For more details run:\nrally -vd task detailed %s")
|
print(_("For more details run:\n"
|
||||||
|
"rally -vd task detailed %s")
|
||||||
% task["uuid"])
|
% task["uuid"])
|
||||||
else:
|
else:
|
||||||
print(yaml.safe_load(verification[2]))
|
print(yaml.safe_load(verification[2]))
|
||||||
return
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
for result in task["results"]:
|
def _print_scenario_args(result):
|
||||||
key = result["key"]
|
key = result["key"]
|
||||||
print("-" * 80)
|
print("-" * 80)
|
||||||
print()
|
print()
|
||||||
@ -355,6 +354,7 @@ class TaskCommands(object):
|
|||||||
print("args values:")
|
print("args values:")
|
||||||
print(json.dumps(key["kw"], indent=2))
|
print(json.dumps(key["kw"], indent=2))
|
||||||
|
|
||||||
|
def _print_summrized_result(result):
|
||||||
raw = result["data"]["raw"]
|
raw = result["data"]["raw"]
|
||||||
table_cols = ["action", "min", "median",
|
table_cols = ["action", "min", "median",
|
||||||
"90%ile", "95%ile", "max",
|
"90%ile", "95%ile", "max",
|
||||||
@ -383,19 +383,16 @@ class TaskCommands(object):
|
|||||||
else:
|
else:
|
||||||
data = [action, None, None, None, None, None, None,
|
data = [action, None, None, None, None, None, None,
|
||||||
"0.0%", len(raw)]
|
"0.0%", len(raw)]
|
||||||
table_rows.append(rutils.Struct(**dict(zip(table_cols, data))))
|
table_rows.append(rutils.Struct(**dict(zip(table_cols,
|
||||||
|
data))))
|
||||||
|
|
||||||
cliutils.print_list(table_rows, fields=table_cols,
|
cliutils.print_list(table_rows, fields=table_cols,
|
||||||
formatters=formatters,
|
formatters=formatters,
|
||||||
table_label="Response Times (sec)",
|
table_label="Response Times (sec)",
|
||||||
sortby_index=None)
|
sortby_index=None)
|
||||||
|
|
||||||
if iterations_data:
|
def _print_ssrs_result(result):
|
||||||
_print_iterations_data(raw)
|
raw = result["data"]["raw"]
|
||||||
|
|
||||||
print(_("Load duration: %s") % result["data"]["load_duration"])
|
|
||||||
print(_("Full duration: %s") % result["data"]["full_duration"])
|
|
||||||
|
|
||||||
# NOTE(hughsaunders): ssrs=scenario specific results
|
# NOTE(hughsaunders): ssrs=scenario specific results
|
||||||
ssrs = []
|
ssrs = []
|
||||||
for result in raw:
|
for result in raw:
|
||||||
@ -428,7 +425,8 @@ class TaskCommands(object):
|
|||||||
round(utils.mean(values), 3)]
|
round(utils.mean(values), 3)]
|
||||||
else:
|
else:
|
||||||
row = [str(key)] + ["n/a"] * 6
|
row = [str(key)] + ["n/a"] * 6
|
||||||
table_rows.append(rutils.Struct(**dict(zip(headers, row))))
|
table_rows.append(rutils.Struct(**dict(zip(headers,
|
||||||
|
row))))
|
||||||
print("\nScenario Specific Results\n")
|
print("\nScenario Specific Results\n")
|
||||||
cliutils.print_list(table_rows,
|
cliutils.print_list(table_rows,
|
||||||
fields=headers,
|
fields=headers,
|
||||||
@ -440,6 +438,7 @@ class TaskCommands(object):
|
|||||||
if errors:
|
if errors:
|
||||||
print(errors)
|
print(errors)
|
||||||
|
|
||||||
|
def _print_hints(task):
|
||||||
print()
|
print()
|
||||||
print("HINTS:")
|
print("HINTS:")
|
||||||
print(_("* To plot HTML graphics with this data, run:"))
|
print(_("* To plot HTML graphics with this data, run:"))
|
||||||
@ -452,6 +451,25 @@ class TaskCommands(object):
|
|||||||
print(_("* To get raw JSON output of task results, run:"))
|
print(_("* To get raw JSON output of task results, run:"))
|
||||||
print("\trally task results %s\n" % task["uuid"])
|
print("\trally task results %s\n" % task["uuid"])
|
||||||
|
|
||||||
|
task = db.task_get_detailed(task_id)
|
||||||
|
|
||||||
|
if task is None:
|
||||||
|
print("The task %s can not be found" % task_id)
|
||||||
|
return(1)
|
||||||
|
|
||||||
|
if _print_task_info(task):
|
||||||
|
for result in task["results"]:
|
||||||
|
_print_scenario_args(result)
|
||||||
|
_print_summrized_result(result)
|
||||||
|
if iterations_data:
|
||||||
|
_print_iterations_data(result)
|
||||||
|
_print_ssrs_result(result)
|
||||||
|
print(_("Load duration: %s") %
|
||||||
|
result["data"]["load_duration"])
|
||||||
|
print(_("Full duration: %s") %
|
||||||
|
result["data"]["full_duration"])
|
||||||
|
_print_hints(task)
|
||||||
|
|
||||||
@cliutils.args("--uuid", type=str, dest="task_id", help="uuid of task")
|
@cliutils.args("--uuid", type=str, dest="task_id", help="uuid of task")
|
||||||
@envutils.with_default_task_id
|
@envutils.with_default_task_id
|
||||||
@cliutils.suppress_warnings
|
@cliutils.suppress_warnings
|
||||||
|
Loading…
Reference in New Issue
Block a user