mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-23 15:40:44 -06:00
nosqlbench-861 Allow dry-run of op generation.
This commit is contained in:
parent
e29bfddc18
commit
d1d21c8e5d
@ -166,6 +166,7 @@ public abstract class BaseDriverAdapter<R extends Op, S> implements DriverAdapte
|
|||||||
.add(Param.optional("instrument", Boolean.class))
|
.add(Param.optional("instrument", Boolean.class))
|
||||||
.add(Param.optional(List.of("workload", "yaml"), String.class, "location of workload yaml file"))
|
.add(Param.optional(List.of("workload", "yaml"), String.class, "location of workload yaml file"))
|
||||||
.add(Param.optional("driver", String.class))
|
.add(Param.optional("driver", String.class))
|
||||||
|
.add(Param.defaultTo("dryrun",false))
|
||||||
.asReadOnly();
|
.asReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package io.nosqlbench.engine.api.activityimpl.uniform;
|
||||||
|
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.RunnableOp;
|
||||||
|
|
||||||
|
public class DryRunOp implements RunnableOp {
|
||||||
|
|
||||||
|
private final Op op;
|
||||||
|
|
||||||
|
public DryRunOp(Op op) {
|
||||||
|
this.op = op;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package io.nosqlbench.engine.api.activityimpl.uniform;
|
||||||
|
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.BaseOpDispenser;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
|
||||||
|
import io.nosqlbench.engine.api.templating.ParsedOp;
|
||||||
|
|
||||||
|
public class DryRunOpDispenserWrapper extends BaseOpDispenser<Op, Object> {
|
||||||
|
|
||||||
|
private final OpDispenser<? extends Op> realDispenser;
|
||||||
|
|
||||||
|
public DryRunOpDispenserWrapper(DriverAdapter<Op,Object> adapter, ParsedOp pop, OpDispenser<? extends Op> realDispenser) {
|
||||||
|
super(adapter, pop);
|
||||||
|
this.realDispenser = realDispenser;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public DryRunOp apply(long cycle) {
|
||||||
|
Op op = realDispenser.apply(cycle);
|
||||||
|
return new DryRunOp(op);
|
||||||
|
}
|
||||||
|
}
|
@ -225,6 +225,8 @@ sstablegen
|
|||||||
* Mac M1 support
|
* Mac M1 support
|
||||||
- as of 08/15, all Mac M1 systems should be supported for the.jar and the docker image
|
- as of 08/15, all Mac M1 systems should be supported for the.jar and the docker image
|
||||||
|
|
||||||
|
* Dry-run mode for all adapter types
|
||||||
|
|
||||||
review:
|
review:
|
||||||
- 7578e91d773a9ea8113250899ef46b7aacf95e70
|
- 7578e91d773a9ea8113250899ef46b7aacf95e70
|
||||||
- 392bbcc5954019ae58956850c980646cef14a1f7
|
- 392bbcc5954019ae58956850c980646cef14a1f7
|
||||||
|
@ -17,7 +17,11 @@
|
|||||||
package io.nosqlbench.engine.api.activityimpl;
|
package io.nosqlbench.engine.api.activityimpl;
|
||||||
|
|
||||||
import com.codahale.metrics.Timer;
|
import com.codahale.metrics.Timer;
|
||||||
|
import io.nosqlbench.api.config.standard.NBConfiguration;
|
||||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||||
|
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
||||||
|
import io.nosqlbench.api.errors.BasicError;
|
||||||
|
import io.nosqlbench.api.errors.OpConfigError;
|
||||||
import io.nosqlbench.engine.api.activityapi.core.*;
|
import io.nosqlbench.engine.api.activityapi.core.*;
|
||||||
import io.nosqlbench.engine.api.activityapi.core.progress.ActivityMetricProgressMeter;
|
import io.nosqlbench.engine.api.activityapi.core.progress.ActivityMetricProgressMeter;
|
||||||
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressCapable;
|
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressCapable;
|
||||||
@ -37,14 +41,11 @@ import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
|||||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
||||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||||
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
|
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.DryRunOpDispenserWrapper;
|
||||||
import io.nosqlbench.engine.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
import io.nosqlbench.engine.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||||
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
|
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
|
||||||
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
|
||||||
import io.nosqlbench.engine.api.templating.CommandTemplate;
|
import io.nosqlbench.engine.api.templating.CommandTemplate;
|
||||||
import io.nosqlbench.engine.api.templating.ParsedOp;
|
import io.nosqlbench.engine.api.templating.ParsedOp;
|
||||||
import io.nosqlbench.api.config.standard.NBConfiguration;
|
|
||||||
import io.nosqlbench.api.errors.BasicError;
|
|
||||||
import io.nosqlbench.api.errors.OpConfigError;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -472,7 +473,6 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
|||||||
List<Long> ratios = new ArrayList<>(pops.size());
|
List<Long> ratios = new ArrayList<>(pops.size());
|
||||||
|
|
||||||
for (int i = 0; i < pops.size(); i++) {
|
for (int i = 0; i < pops.size(); i++) {
|
||||||
|
|
||||||
ParsedOp pop = pops.get(i);
|
ParsedOp pop = pops.get(i);
|
||||||
long ratio = pop.takeStaticConfigOr("ratio", 1);
|
long ratio = pop.takeStaticConfigOr("ratio", 1);
|
||||||
ratios.add(ratio);
|
ratios.add(ratio);
|
||||||
@ -484,21 +484,34 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
|||||||
.orElse(SequencerType.bucket);
|
.orElse(SequencerType.bucket);
|
||||||
SequencePlanner<OpDispenser<? extends O>> planner = new SequencePlanner<>(sequencerType);
|
SequencePlanner<OpDispenser<? extends O>> planner = new SequencePlanner<>(sequencerType);
|
||||||
|
|
||||||
|
int dryrunCount=0;
|
||||||
for (int i = 0; i < pops.size(); i++) {
|
for (int i = 0; i < pops.size(); i++) {
|
||||||
long ratio = ratios.get(i);
|
long ratio = ratios.get(i);
|
||||||
ParsedOp pop = pops.get(i);
|
ParsedOp pop = pops.get(i);
|
||||||
if (ratio==0) {
|
if (ratio == 0) {
|
||||||
logger.info("skipped mapping op '" + pop.getName() + "'");
|
logger.info("skipped mapping op '" + pop.getName() + "'");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
boolean dryrun = pop.takeStaticConfigOr("dryrun", false);
|
||||||
|
|
||||||
DriverAdapter adapter = adapters.get(i);
|
DriverAdapter adapter = adapters.get(i);
|
||||||
OpMapper opMapper = adapter.getOpMapper();
|
OpMapper opMapper = adapter.getOpMapper();
|
||||||
OpDispenser<? extends Op> dispenser = opMapper.apply(pop);
|
OpDispenser<? extends Op> dispenser = opMapper.apply(pop);
|
||||||
|
|
||||||
|
if (dryrun) {
|
||||||
|
dispenser = new DryRunOpDispenserWrapper(adapter, pop, dispenser);
|
||||||
|
dryrunCount++;
|
||||||
|
}
|
||||||
|
|
||||||
// if (strict) {
|
// if (strict) {
|
||||||
// optemplate.assertConsumed();
|
// optemplate.assertConsumed();
|
||||||
// }
|
// }
|
||||||
planner.addOp((OpDispenser<? extends O>) dispenser, ratio);
|
planner.addOp((OpDispenser<? extends O>) dispenser, ratio);
|
||||||
}
|
}
|
||||||
|
if (dryrunCount>0) {
|
||||||
|
logger.warn("initialized " + dryrunCount + " op templates for dry run only. These ops will be synthesized for each cycle, but will not be executed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return planner.resolve();
|
return planner.resolve();
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ package io.nosqlbench.engine.api.activityimpl.uniform;
|
|||||||
|
|
||||||
import io.nosqlbench.engine.api.activityapi.core.ActionDispenser;
|
import io.nosqlbench.engine.api.activityapi.core.ActionDispenser;
|
||||||
import io.nosqlbench.engine.api.activityapi.core.Activity;
|
import io.nosqlbench.engine.api.activityapi.core.Activity;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.actions.StandardAction;
|
||||||
|
|
||||||
public class StandardActionDispenser implements ActionDispenser {
|
public class StandardActionDispenser implements ActionDispenser {
|
||||||
private final StandardActivity<?,?> activity;
|
private final StandardActivity<?,?> activity;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.nosqlbench.engine.api.activityimpl.uniform;
|
package io.nosqlbench.engine.api.activityimpl.uniform.actions;
|
||||||
|
|
||||||
import com.codahale.metrics.Histogram;
|
import com.codahale.metrics.Histogram;
|
||||||
import com.codahale.metrics.Timer;
|
import com.codahale.metrics.Timer;
|
||||||
@ -25,6 +25,7 @@ import io.nosqlbench.engine.api.activityapi.errorhandling.modular.NBErrorHandler
|
|||||||
import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
|
import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
|
||||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||||
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
|
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
|
||||||
|
import io.nosqlbench.engine.api.activityimpl.uniform.StandardActivity;
|
||||||
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.*;
|
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.*;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
Loading…
Reference in New Issue
Block a user