mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
support for param=UNDEF in named scenario templates
This commit is contained in:
parent
034c8a9417
commit
becab83c2c
@ -1,7 +1,7 @@
|
|||||||
# nb -v run driver=cql yaml=cql-iot tags=phase:schema host=dsehost
|
# nb -v run driver=cql yaml=cql-iot tags=phase:schema host=dsehost
|
||||||
scenarios:
|
scenarios:
|
||||||
default:
|
default:
|
||||||
- run driver=cql tags==phase:schema threads==1
|
- run driver=cql tags==phase:schema threads==1 cycles==UNDEF
|
||||||
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
||||||
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
||||||
bindings:
|
bindings:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# nb -v run driver=cql yaml=cql-iot tags=phase:schema host=dsehost
|
# nb -v run driver=cql yaml=cql-iot tags=phase:schema host=dsehost
|
||||||
scenarios:
|
scenarios:
|
||||||
default:
|
default:
|
||||||
- run driver=cql tags==phase:schema threads==1
|
- run driver=cql tags==phase:schema threads==1 cycles==UNDEF
|
||||||
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
||||||
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
||||||
params:
|
params:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# nb -v run driver=cql yaml=cql-keyvalue tags=phase:schema host=dsehost
|
# nb -v run driver=cql yaml=cql-keyvalue tags=phase:schema host=dsehost
|
||||||
scenarios:
|
scenarios:
|
||||||
default:
|
default:
|
||||||
- run driver=cql tags==phase:schema threads==1
|
- run driver=cql tags==phase:schema threads==1 cycles==UNDEF
|
||||||
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
||||||
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
||||||
bindings:
|
bindings:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# nb -v cql-tabular rampup-cycles=1E6 main-cycles=1E9
|
# nb -v cql-tabular rampup-cycles=1E6 main-cycles=1E9
|
||||||
scenarios:
|
scenarios:
|
||||||
default:
|
default:
|
||||||
- run driver=cql tags==phase:schema threads==1
|
- run driver=cql tags==phase:schema threads==1 cycles==UNDEF
|
||||||
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
|
||||||
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
|
||||||
bindings:
|
bindings:
|
||||||
|
@ -61,12 +61,12 @@ public class NBCLI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run(String[] args) {
|
public void run(String[] args) {
|
||||||
if (args.length>0 && args[0].toLowerCase().equals("virtdata")) {
|
if (args.length > 0 && args[0].toLowerCase().equals("virtdata")) {
|
||||||
VirtDataMainApp.main(Arrays.copyOfRange(args,1,args.length));
|
VirtDataMainApp.main(Arrays.copyOfRange(args, 1, args.length));
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
if (args.length>0 && args[0].toLowerCase().equals("docserver")) {
|
if (args.length > 0 && args[0].toLowerCase().equals("docserver")) {
|
||||||
DocServerApp.main(Arrays.copyOfRange(args,1,args.length));
|
DocServerApp.main(Arrays.copyOfRange(args, 1, args.length));
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +93,13 @@ public class NBCLI {
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.wantsWorkloadsList()) {
|
||||||
|
printWorkloads(false);
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.wantsScenariosList()) {
|
if (options.wantsScenariosList()) {
|
||||||
printWorkloads();
|
printWorkloads(true);
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,11 +116,11 @@ public class NBCLI {
|
|||||||
throw new BasicError("A file named " + writeTo.toString() + " exists. Remove it first.");
|
throw new BasicError("A file named " + writeTo.toString() + " exists. Remove it first.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Files.writeString(writeTo,data.getCharBuffer(), StandardCharsets.UTF_8);
|
Files.writeString(writeTo, data.getCharBuffer(), StandardCharsets.UTF_8);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BasicError("Unable to write to " + writeTo.toString() + ": " + e.getMessage());
|
throw new BasicError("Unable to write to " + writeTo.toString() + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
logger.info("Copied internal resource '" + data.asPath() + "' to '" + writeTo.toString() +"'");
|
logger.info("Copied internal resource '" + data.asPath() + "' to '" + writeTo.toString() + "'");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -143,7 +148,7 @@ public class NBCLI {
|
|||||||
if (options.wantsTopicalHelp()) {
|
if (options.wantsTopicalHelp()) {
|
||||||
Optional<String> helpDoc = MarkdownDocInfo.forHelpTopic(options.wantsTopicalHelpFor());
|
Optional<String> helpDoc = MarkdownDocInfo.forHelpTopic(options.wantsTopicalHelpFor());
|
||||||
System.out.println(helpDoc.orElseThrow(
|
System.out.println(helpDoc.orElseThrow(
|
||||||
() -> new RuntimeException("No help could be found for " + options.wantsTopicalHelpFor())
|
() -> new RuntimeException("No help could be found for " + options.wantsTopicalHelpFor())
|
||||||
));
|
));
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
@ -156,19 +161,19 @@ public class NBCLI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String reportGraphiteTo = options.wantsReportGraphiteTo();
|
String reportGraphiteTo = options.wantsReportGraphiteTo();
|
||||||
if (options.wantsDockerMetrics()){
|
if (options.wantsDockerMetrics()) {
|
||||||
logger.info("Docker metrics is enabled. Docker must be installed for this to work");
|
logger.info("Docker metrics is enabled. Docker must be installed for this to work");
|
||||||
DockerMetricsManager dmh= new DockerMetricsManager();
|
DockerMetricsManager dmh = new DockerMetricsManager();
|
||||||
dmh.startMetrics();
|
dmh.startMetrics();
|
||||||
logger.info("Docker Containers are started, for grafana and prometheus, hit" +
|
logger.info("Docker Containers are started, for grafana and prometheus, hit" +
|
||||||
"these urls in your browser: http://<host>:3000 and http://<host>:9090" +
|
"these urls in your browser: http://<host>:3000 and http://<host>:9090" +
|
||||||
"the default grafana creds are admin/admin");
|
"the default grafana creds are admin/admin");
|
||||||
if (reportGraphiteTo != null){
|
if (reportGraphiteTo != null) {
|
||||||
logger.warn(String.format("Docker metrics are enabled (--docker-metrics)" +
|
logger.warn(String.format("Docker metrics are enabled (--docker-metrics)" +
|
||||||
" but graphite reporting (--report-graphite-to) is set to %s \n" +
|
" but graphite reporting (--report-graphite-to) is set to %s \n" +
|
||||||
"usually only one of the two is configured.",
|
"usually only one of the two is configured.",
|
||||||
reportGraphiteTo));
|
reportGraphiteTo));
|
||||||
}else{
|
} else {
|
||||||
//TODO: is this right?
|
//TODO: is this right?
|
||||||
logger.info("Setting graphite reporting to localhost");
|
logger.info("Setting graphite reporting to localhost");
|
||||||
reportGraphiteTo = "localhost:9109";
|
reportGraphiteTo = "localhost:9109";
|
||||||
@ -180,7 +185,7 @@ public class NBCLI {
|
|||||||
reporters.addRegistry("workloads", ActivityMetrics.getMetricRegistry());
|
reporters.addRegistry("workloads", ActivityMetrics.getMetricRegistry());
|
||||||
|
|
||||||
if (reportGraphiteTo != null) {
|
if (reportGraphiteTo != null) {
|
||||||
reporters.addGraphite(reportGraphiteTo, options.wantsMetricsPrefix());
|
reporters.addGraphite(reportGraphiteTo, options.wantsMetricsPrefix());
|
||||||
}
|
}
|
||||||
if (options.wantsReportCsvTo() != null) {
|
if (options.wantsReportCsvTo() != null) {
|
||||||
reporters.addCSVReporter(options.wantsReportCsvTo(), options.wantsMetricsPrefix());
|
reporters.addCSVReporter(options.wantsReportCsvTo(), options.wantsMetricsPrefix());
|
||||||
@ -190,7 +195,7 @@ public class NBCLI {
|
|||||||
|
|
||||||
String sessionName = new SessionNamer().format(options.getSessionName());
|
String sessionName = new SessionNamer().format(options.getSessionName());
|
||||||
|
|
||||||
if (options.wantsEnableChart()){
|
if (options.wantsEnableChart()) {
|
||||||
logger.info("Charting enabled");
|
logger.info("Charting enabled");
|
||||||
if (options.getHistoLoggerConfigs().size() == 0) {
|
if (options.getHistoLoggerConfigs().size() == 0) {
|
||||||
logger.info("Adding default histologger configs");
|
logger.info("Adding default histologger configs");
|
||||||
@ -229,21 +234,21 @@ public class NBCLI {
|
|||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.wantsEnableChart()){
|
if (options.wantsEnableChart()) {
|
||||||
logger.info("Charting enabled");
|
logger.info("Charting enabled");
|
||||||
scenario.enableCharting();
|
scenario.enableCharting();
|
||||||
} else{
|
} else {
|
||||||
logger.info("Charting disabled");
|
logger.info("Charting disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
scenario.addScenarioScriptParams(scriptData.getScriptParams());
|
scenario.addScenarioScriptParams(scriptData.getScriptParams());
|
||||||
scenario.addScriptText(scriptData.getScriptTextIgnoringParams());
|
scenario.addScriptText(scriptData.getScriptTextIgnoringParams());
|
||||||
ScenarioLogger sl = new ScenarioLogger(scenario)
|
ScenarioLogger sl = new ScenarioLogger(scenario)
|
||||||
.setLogDir(options.getLogsDirectory())
|
.setLogDir(options.getLogsDirectory())
|
||||||
.setMaxLogs(options.getLogsMax())
|
.setMaxLogs(options.getLogsMax())
|
||||||
.setLevel(options.getLogsLevel())
|
.setLevel(options.getLogsLevel())
|
||||||
.setLogLevelOverrides(options.getLogLevelOverrides())
|
.setLogLevelOverrides(options.getLogLevelOverrides())
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
executor.execute(scenario, sl);
|
executor.execute(scenario, sl);
|
||||||
ScenariosResults scenariosResults = executor.awaitAllResults();
|
ScenariosResults scenariosResults = executor.awaitAllResults();
|
||||||
@ -258,28 +263,33 @@ public class NBCLI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printWorkloads() {
|
public void printWorkloads(boolean includeScenarios) {
|
||||||
List<WorkloadDesc> workloads = NBCLIScenarioParser.getWorkloadsWithScenarioScripts();
|
List<WorkloadDesc> workloads = NBCLIScenarioParser.getWorkloadsWithScenarioScripts();
|
||||||
for (WorkloadDesc workload : workloads) {
|
for (WorkloadDesc workload : workloads) {
|
||||||
System.out.println("\n# from: "+ workload.getYamlPath());
|
System.out.println(workload.getYamlPath());
|
||||||
List<String> scenarioList = workload.getScenarioNames();
|
|
||||||
String workloadName = workload.getYamlPath().replaceAll("\\.yaml", "") ;
|
|
||||||
Set<String> templates = workload.getTemplates();
|
|
||||||
|
|
||||||
for (String scenario : scenarioList) {
|
if (includeScenarios) {
|
||||||
if (scenario.equals("default")) {
|
System.out.println(" # scenarios:");
|
||||||
scenario = scenario + "\n # same as running ./nb " + workloadName ;
|
|
||||||
|
List<String> scenarioList = workload.getScenarioNames();
|
||||||
|
String workloadName = workload.getYamlPath().replaceAll("\\.yaml", "");
|
||||||
|
|
||||||
|
for (String scenario : scenarioList) {
|
||||||
|
System.out.println(" nb " + workloadName + " " + scenario);
|
||||||
}
|
}
|
||||||
System.out.println(" ./nb " + workloadName + " " + scenario);
|
|
||||||
}
|
Set<String> templates = workload.getTemplates();
|
||||||
if (templates.size()>0){
|
if (templates.size() > 0) {
|
||||||
System.out.println("# with the following optional parameters and defaults: ");
|
System.out.println(" # defaults");
|
||||||
templates.stream()
|
templates.stream()
|
||||||
.map(x -> x.replaceAll(",","="))
|
.map(x -> x.replaceAll(",", "="))
|
||||||
.map(x -> x.replaceAll(":","="))
|
.map(x -> x.replaceAll(":", "="))
|
||||||
.map(x -> " # "+x)
|
.map(x -> " " + x)
|
||||||
.forEach(System.out::println);
|
.forEach(System.out::println);
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ public class NBCLIOptions {
|
|||||||
private boolean dockerMetrics = false;
|
private boolean dockerMetrics = false;
|
||||||
private boolean wantsScenariosList = false;
|
private boolean wantsScenariosList = false;
|
||||||
private String wantsToCopyWorkload = null;
|
private String wantsToCopyWorkload = null;
|
||||||
|
private boolean wantsWorkloadsList = false;
|
||||||
|
|
||||||
public NBCLIOptions(String[] args) {
|
public NBCLIOptions(String[] args) {
|
||||||
parse(args);
|
parse(args);
|
||||||
@ -308,10 +309,13 @@ public class NBCLIOptions {
|
|||||||
consoleLoggingPattern = readWordOrThrow(arglist, "logging pattern");
|
consoleLoggingPattern = readWordOrThrow(arglist, "logging pattern");
|
||||||
break;
|
break;
|
||||||
case LIST_SCENARIOS:
|
case LIST_SCENARIOS:
|
||||||
case LIST_WORKLOADS:
|
|
||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
wantsScenariosList = true;
|
wantsScenariosList = true;
|
||||||
break;
|
break;
|
||||||
|
case LIST_WORKLOADS:
|
||||||
|
arglist.removeFirst();
|
||||||
|
wantsWorkloadsList =true;
|
||||||
|
break;
|
||||||
case COPY_WORKLOAD:
|
case COPY_WORKLOAD:
|
||||||
arglist.removeFirst();
|
arglist.removeFirst();
|
||||||
wantsToCopyWorkload = readWordOrThrow(arglist, "workload to copy");
|
wantsToCopyWorkload = readWordOrThrow(arglist, "workload to copy");
|
||||||
@ -578,6 +582,10 @@ public class NBCLIOptions {
|
|||||||
return wantsToCopyWorkload;
|
return wantsToCopyWorkload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean wantsWorkloadsList() {
|
||||||
|
return wantsWorkloadsList;
|
||||||
|
}
|
||||||
|
|
||||||
public static enum CmdType {
|
public static enum CmdType {
|
||||||
start,
|
start,
|
||||||
run,
|
run,
|
||||||
|
@ -111,6 +111,14 @@ public class NBCLIScenarioParser {
|
|||||||
builtcmd.put("workload", "workload=" + workloadPath.toString());
|
builtcmd.put("workload", "workload=" + workloadPath.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Undefine any keys with a value of 'undef'
|
||||||
|
List<String> undefKeys = builtcmd.entrySet()
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.getValue().toLowerCase().endsWith("=undef"))
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
undefKeys.forEach(builtcmd::remove);
|
||||||
|
|
||||||
logger.debug("Named scenario built command: " + String.join(" ", builtcmd.values()));
|
logger.debug("Named scenario built command: " + String.join(" ", builtcmd.values()));
|
||||||
buildCmdBuffer.addAll(builtcmd.values());
|
buildCmdBuffer.addAll(builtcmd.values());
|
||||||
}
|
}
|
||||||
|
@ -84,5 +84,18 @@ public class NBCLIScenarioParserTest {
|
|||||||
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("driver=stdout;cycles=20;cycles-test=20;workload=activities/scenario-test.yaml;");
|
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("driver=stdout;cycles=20;cycles-test=20;workload=activities/scenario-test.yaml;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testThatUndefValuesAreUndefined() {
|
||||||
|
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "schema-only", "cycles-test=20"});
|
||||||
|
List<NBCLIOptions.Cmd> cmds = opts.getCommands();
|
||||||
|
assertThat(cmds.size()).isEqualTo(1);
|
||||||
|
assertThat(cmds.get(0).getCmdSpec()).isEqualTo("driver=stdout;workload=scenario-test;tags=phase:schema;cycles-test=20;");
|
||||||
|
NBCLIOptions opts1 = new NBCLIOptions(new String[]{ "scenario-test", "schema-only", "doundef=20"});
|
||||||
|
List<NBCLIOptions.Cmd> cmds1 = opts1.getCommands();
|
||||||
|
assertThat(cmds1.size()).isEqualTo(1);
|
||||||
|
assertThat(cmds1.get(0).getCmdSpec()).isEqualTo("driver=stdout;workload=scenario-test;tags=phase:schema;");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ scenarios:
|
|||||||
- run driver=stdout yaml===scenario-test tags=phase:rampup cycles=TEMPLATE(cycles1,10)
|
- run driver=stdout yaml===scenario-test tags=phase:rampup cycles=TEMPLATE(cycles1,10)
|
||||||
- run driver=stdout yaml===scenario-test tags=phase:main cycles=TEMPLATE(cycles2,10)
|
- run driver=stdout yaml===scenario-test tags=phase:main cycles=TEMPLATE(cycles2,10)
|
||||||
schema-only:
|
schema-only:
|
||||||
- "run driver=stdout yaml=scenario-test tags=phase:schema"
|
- "run driver=stdout yaml=scenario-test tags=phase:schema doundef==undef"
|
||||||
template-test:
|
template-test:
|
||||||
with-template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
with-template: run driver=stdout cycles=TEMPLATE(cycles-test,10)
|
||||||
blocks:
|
blocks:
|
||||||
|
Loading…
Reference in New Issue
Block a user