DEFAULT_BUCKET = "lava"
+def json_type(string):
+ """
+ Argpase type for json args.
+ We expect a base dictionary.
+ """
+ passed_json = json.loads(string)
+ if not isinstance(passed_json, dict):
+ msg = "%r is not a dict" % string
+ raise argparse.ArgumentTypeError(msg)
+ return passed_json
+
def graph_get_color(branch):
"""
Get the color matching the branch.
plt.tight_layout()
return
-def plot_delta_between_point(branch, benchmark_type, x_data, y_data, labels, latest_values):
+
+def plot_delta_between_point(
+ branch, benchmark_type, x_data, y_data, labels, latest_values
+):
"""
Plot the graph of delta between each sequential commit.
"""
ax = plt.gca()
plt.xticks(x_data, labels, rotation=90, family="monospace")
- plt.title(graph_get_title(branch, benchmark_type) + " Delta to previous commit", fontweight="bold")
+ plt.title(
+ graph_get_title(branch, benchmark_type) + " Delta to previous commit",
+ fontweight="bold",
+ )
plt.ylabel("Seconds")
plt.xlabel("Latest commits")
plt.legend()
plt.tight_layout()
return
+
def plot_ratio(branch, benchmark_type, x_data, y_data, labels, latest_values):
"""
Plot the graph using a ratio using first point as reference (0%).
plt.tight_layout()
return
+
def generate_graph(branches, report_name, git_path):
# The PDF document
pdf_pages.savefig(fig)
fig = plt.figure(figsize=(width, 8.27), dpi=100)
- plot_delta_between_point(branch, b_type, x_data, y_data, labels, latest_values)
+ plot_delta_between_point(
+ branch, b_type, x_data, y_data, labels, latest_values
+ )
pdf_pages.savefig(fig)
pdf_pages.close()
-def launch_jobs(branches, git_path, wait_for_completion, debug):
+def launch_jobs(branches, git_path, wait_for_completion, debug, force):
"""
Lauch jobs for all missing results.
"""
with tempfile.TemporaryDirectory() as workdir:
for commit in commits:
b_results = get_benchmark_results(client, commit, workdir)[0]
- if b_results:
+ if b_results and not force:
continue
lava_submit.submit(
commit, wait_for_completion=wait_for_completion, debug=debug
parser.add_argument(
"--generate-jobs", action="store_true", help="Generate and send jobs"
)
+ parser.add_argument(
+ "--force-jobs", action="store_true", help="Force the queueing of jobs to lava"
+ )
parser.add_argument(
"--do-not-wait-on-completion",
action="store_true",
parser.add_argument(
"--repo-path", help="The location of the git repo to use.", required=True
)
+ parser.add_argument(
+ "--overwrite-branches-cutoff",
+ help="A dictionary of the form {"
+ "'branch_name': 'commit_hash_cutoff',...}. Allow custom graphing and"
+ "jobs generation.",
+ required=False, type=json_type
+ )
args = parser.parse_args()
+ if args.overwrite_branches_cutoff:
+ bt_branches = args.overwrite_branches_cutoff
+
if not os.path.exists(args.repo_path):
print("Repository location does not exists.")
return 1
if args.generate_jobs:
print("Launching jobs for:")
+
for branch, cutoff in bt_branches.items():
print("\t Branch {} with cutoff {}".format(branch, cutoff))
+
launch_jobs(
- bt_branches, args.repo_path, not args.do_not_wait_on_completion, args.debug
+ bt_branches,
+ args.repo_path,
+ not args.do_not_wait_on_completion,
+ args.debug,
+ args.force_jobs,
)
if args.generate_report: