mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
unbreak decorator interface
This commit is contained in:
@@ -32,7 +32,7 @@ import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Service(value= DriverAdapter.class,selector = "stdout")
|
||||
public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace> implements OpTemplateSupplier, io.nosqlbench.engine.api.activityimpl.DefaultOpTemplateSupplier {
|
||||
public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace> implements OpTemplateSupplier {
|
||||
|
||||
@Override
|
||||
public OpMapper<StdoutOp> getOpMapper() {
|
||||
|
||||
@@ -76,6 +76,7 @@ public class SimpleActivity implements Activity, ProgressCapable {
|
||||
private ErrorMetrics errorMetrics;
|
||||
private NBErrorHandler errorHandler;
|
||||
private ActivityMetricProgressMeter progressMeter;
|
||||
private String workloadSource = "unspecified";
|
||||
|
||||
public SimpleActivity(ActivityDef activityDef) {
|
||||
this.activityDef = activityDef;
|
||||
@@ -500,25 +501,29 @@ public class SimpleActivity implements Activity, ProgressCapable {
|
||||
.orElse(SequencerType.bucket);
|
||||
SequencePlanner<OpDispenser<? extends O>> planner = new SequencePlanner<>(sequencerType);
|
||||
|
||||
StmtsDocList stmtsDocList = null;
|
||||
|
||||
|
||||
String workloadSource = "unspecified";
|
||||
Optional<String> stmt = activityDef.getParams().getOptionalString("op", "stmt", "statement");
|
||||
Optional<String> op_yaml_loc = activityDef.getParams().getOptionalString("yaml", "workload");
|
||||
if (stmt.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadStmt(logger, stmt.get(), activityDef.getParams());
|
||||
workloadSource = "commandline:" + stmt.get();
|
||||
} else if (op_yaml_loc.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadPath(logger, op_yaml_loc.get(), activityDef.getParams(), "activities");
|
||||
workloadSource = "yaml:" + op_yaml_loc.get();
|
||||
}
|
||||
StmtsDocList stmtsDocList = loadStmtsDocList();
|
||||
|
||||
if (stmtsDocList == null) {
|
||||
throw new OpConfigError("No op templates found. You must provide either workload=... or op=...");
|
||||
}
|
||||
|
||||
List<OpTemplate> beforeFiltering = stmtsDocList.getStmts();
|
||||
List<OpTemplate> stmts = stmtsDocList.getStmts(tagfilter);
|
||||
|
||||
if (stmts.size() == 0) {
|
||||
if (beforeFiltering.size()>0) {
|
||||
throw new BasicError("There were no active statements with tag filter '"
|
||||
+ tagfilter + "', since all " + beforeFiltering.size()+ " were filtered out.");
|
||||
} else {
|
||||
if (this instanceof DefaultOpTemplateSupplier s) {
|
||||
stmts = s.getDefaultTemplates(stmtsDocList);
|
||||
Objects.requireNonNull(stmts);
|
||||
}
|
||||
}
|
||||
if (stmts.size()==0) {
|
||||
throw new BasicError("There were no active statements with tag filter '" + tagfilter + "'");
|
||||
}
|
||||
}
|
||||
|
||||
List<Long> ratios = new ArrayList<>(stmts.size());
|
||||
|
||||
for (int i = 0; i < stmts.size(); i++) {
|
||||
@@ -527,9 +532,7 @@ public class SimpleActivity implements Activity, ProgressCapable {
|
||||
ratios.add(ratio);
|
||||
}
|
||||
|
||||
if (stmts.size() == 0) {
|
||||
throw new BasicError("There were no active statements with tag filter '" + tagfilter + "'");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
|
||||
@@ -549,6 +552,29 @@ public class SimpleActivity implements Activity, ProgressCapable {
|
||||
return planner.resolve();
|
||||
}
|
||||
|
||||
protected StmtsDocList loadStmtsDocList() {
|
||||
|
||||
try {
|
||||
StmtsDocList stmtsDocList = null;
|
||||
|
||||
Optional<String> stmt = activityDef.getParams().getOptionalString("op", "stmt", "statement");
|
||||
Optional<String> op_yaml_loc = activityDef.getParams().getOptionalString("yaml", "workload");
|
||||
if (stmt.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadStmt(logger, stmt.get(), activityDef.getParams());
|
||||
workloadSource = "commandline:" + stmt.get();
|
||||
} else if (op_yaml_loc.isPresent()) {
|
||||
stmtsDocList = StatementsLoader.loadPath(logger, op_yaml_loc.get(), activityDef.getParams(), "activities");
|
||||
workloadSource = "yaml:" + op_yaml_loc.get();
|
||||
}
|
||||
|
||||
return stmtsDocList;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new OpConfigError("Error loading op templates: " + e.toString(), workloadSource, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ProgressMeter getProgressMeter() {
|
||||
if (progressMeter == null) {
|
||||
|
||||
20
pom.xml
20
pom.xml
@@ -59,17 +59,6 @@
|
||||
<module>adapter-dynamodb</module>
|
||||
<module>adapter-diag</module>
|
||||
<module>adapter-stdout</module>
|
||||
<module>driver-diag</module>
|
||||
<module>driver-stdout</module>
|
||||
<module>driver-tcp</module>
|
||||
<module>driver-http</module>
|
||||
<module>driver-kafka</module>
|
||||
<module>driver-mongodb</module>
|
||||
<module>driver-jmx</module>
|
||||
<module>driver-jdbc</module>
|
||||
<module>driver-cockroachdb</module>
|
||||
<module>driver-pulsar</module>
|
||||
<module>driver-jms</module>
|
||||
|
||||
|
||||
<!-- VIRTDATA MODULES -->
|
||||
@@ -96,6 +85,15 @@
|
||||
</activation>
|
||||
<modules>
|
||||
<module>nb</module>
|
||||
<module>driver-tcp</module>
|
||||
<module>driver-http</module>
|
||||
<module>driver-kafka</module>
|
||||
<module>driver-jmx</module>
|
||||
<module>driver-jdbc</module>
|
||||
<module>driver-cockroachdb</module>
|
||||
<module>driver-pulsar</module>
|
||||
<module>driver-jms</module>
|
||||
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
||||
Reference in New Issue
Block a user