mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-28 17:51:06 -06:00
core activity impl now handles alias defaults
This commit is contained in:
parent
3d2ff55f1c
commit
40897879ec
@ -34,11 +34,6 @@ public class CqlActivityType implements ActivityType<CqlActivity> {
|
||||
throw new RuntimeException("Currently, the cql activity type requires yaml/workload activity parameter.");
|
||||
}
|
||||
|
||||
// allow shortcut: yaml parameter provide the default alias name
|
||||
if (activityDef.getAlias().equals(ActivityDef.DEFAULT_ALIAS)) {
|
||||
activityDef.getParams().set("alias",yaml.get());
|
||||
}
|
||||
|
||||
return new CqlActivity(activityDef);
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,6 @@ public class StdoutActivityType implements ActivityType<StdoutActivity> {
|
||||
".");
|
||||
}
|
||||
|
||||
// allow shortcut: yaml parameter provide the default alias name
|
||||
if (activityDef.getAlias().equals(ActivityDef.DEFAULT_ALIAS)) {
|
||||
activityDef.getParams().set("alias",yaml.get());
|
||||
}
|
||||
|
||||
return new StdoutActivity(activityDef);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@ -52,9 +53,23 @@ public class SimpleActivity implements Activity, ProgressCapable {
|
||||
private ActivityInstrumentation activityInstrumentation;
|
||||
private PrintWriter console;
|
||||
private long startedAtMillis;
|
||||
private int nameEnumerator = 0;
|
||||
|
||||
public SimpleActivity(ActivityDef activityDef) {
|
||||
this.activityDef = activityDef;
|
||||
if (activityDef.getAlias().equals(ActivityDef.DEFAULT_ALIAS)) {
|
||||
Optional<String> workloadOpt = activityDef.getParams().getOptionalString(
|
||||
"workload",
|
||||
"yaml"
|
||||
);
|
||||
if (workloadOpt.isPresent()) {
|
||||
activityDef.getParams().set("alias", workloadOpt.get());
|
||||
} else {
|
||||
activityDef.getParams().set("alias",
|
||||
activityDef.getActivityType().toUpperCase(Locale.ROOT)
|
||||
+ String.valueOf(nameEnumerator++));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleActivity(String activityDefString) {
|
||||
|
Loading…
Reference in New Issue
Block a user