simplify output for listing scenarios and workloads

This commit is contained in:
Jonathan Shook 2020-06-08 18:02:19 -05:00
parent 512759af9a
commit 0ef8d633ad
5 changed files with 35 additions and 17 deletions

View File

@ -1,4 +1,5 @@
# nb -v run driver=cql yaml=cql-keyvalue tags=phase:schema host=dsehost
description: A workload with only text keys and text values
scenarios:
default:
schema: run driver=cql tags==phase:schema threads==1 cycles==UNDEF

View File

@ -1,4 +1,5 @@
# nb -v cql-tabular rampup-cycles=1E6 main-cycles=1E9
description: A tabular workload with partitions, clusters, and data fields
scenarios:
default:
schema: run driver=cql tags==phase:schema threads==1 cycles==UNDEF

View File

@ -308,6 +308,7 @@ public class NBCLIScenarioParser {
workloadDescriptions.add(new WorkloadDesc(path, scenarioNames, sortedTemplates, description));
}
}
Collections.sort(workloadDescriptions);
return workloadDescriptions;
}

View File

@ -1,9 +1,11 @@
package io.nosqlbench.engine.api.scenarios;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Map;
public class WorkloadDesc {
public class WorkloadDesc implements Comparable<WorkloadDesc> {
private final String yamlPath;
private final List<String> scenarioNames;
private final Map<String, String> templates;
@ -48,17 +50,28 @@ public class WorkloadDesc {
StringBuilder sb = new StringBuilder();
if (description.isEmpty()) {
sb.append("# no description provided\n");
}
if (!description.isEmpty()) {
// sb.append("# description:\n");
String formttedDesc = "# " + String.join("\n# ",description.split("\n"));
sb.append(formttedDesc).append("\n");
while (sb.toString().endsWith("\n\n")) {
sb.setLength(sb.length()-1);
}
// if (!description.endsWith("\n")) {
// sb.append("\n");
// }
}
if (includeScenarios) {
sb.append("# workload in ");
sb.append("# workload found in in ");
}
sb.append(getYamlPath()).append("\n");
if (!description.isEmpty()) {
sb.append("# description:\n").append(description);
if (!description.endsWith("\n")) {
sb.append("\n");
}
}
if (includeScenarios) {
sb.append(" # scenarios:\n");
@ -83,4 +96,9 @@ public class WorkloadDesc {
return sb.toString();
}
@Override
public int compareTo(@NotNull WorkloadDesc o) {
return this.yamlPath.compareTo(o.yamlPath);
}
}

View File

@ -14,19 +14,16 @@ public class NBCLIScenarios {
for (WorkloadDesc workload : workloads) {
System.out.println(workload.toString(includeScenarios));
}
if (!includeScenarios) {
System.out.println("\n# To see scenarios scenarios, use --list-scenarios");
System.out.println("## To see scenarios scenarios, use --list-scenarios");
}
System.out.println(
"\n" +
"# To include examples, add --include=examples\n" +
"# To copy any of these to your local directory, use\n" +
"# --include=examples --copy=examplename\n"
"## To include examples, add --include=examples\n" +
"## To copy any of these to your local directory, use\n" +
"## --include=examples --copy=examplename\n"
);
}