mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-23 07:34:31 -06:00
recall computation
This commit is contained in:
parent
b5092ec65e
commit
497432137e
@ -68,31 +68,38 @@
|
|||||||
<version>4.17.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.docker-java</groupId>
|
|
||||||
<artifactId>docker-java-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.snakeyaml</groupId>
|
<groupId>org.snakeyaml</groupId>
|
||||||
<artifactId>snakeyaml-engine</artifactId>
|
<artifactId>snakeyaml-engine</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- For CQL compression option -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial.snappy</groupId>
|
<groupId>org.xerial.snappy</groupId>
|
||||||
<artifactId>snappy-java</artifactId>
|
<artifactId>snappy-java</artifactId>
|
||||||
|
<version>1.1.10.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.esri.geometry</groupId>
|
<groupId>com.esri.geometry</groupId>
|
||||||
<artifactId>esri-geometry-api</artifactId>
|
<artifactId>esri-geometry-api</artifactId>
|
||||||
|
<version>2.2.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>info.picocli</groupId>
|
<groupId>info.picocli</groupId>
|
||||||
<artifactId>picocli</artifactId>
|
<artifactId>picocli</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bouncycastle</groupId>
|
||||||
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
|
<version>1.69</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.15.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 nosqlbench
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.nosqlbench.engine.extensions.vectormath;
|
||||||
|
|
||||||
|
import com.datastax.oss.driver.api.core.cql.Row;
|
||||||
|
import com.datastax.oss.driver.shaded.guava.common.collect.Sets;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class VectorMath {
|
||||||
|
public double computeRecall(List<Row> rows, List<Long> expectedRowIds) {
|
||||||
|
Set<String> found = rows.stream().map(r -> r.getString("key")).collect(Collectors.toSet());
|
||||||
|
Set<String> expected = expectedRowIds.stream().map(String::valueOf).collect(Collectors.toSet());
|
||||||
|
return ((double)Sets.intersection(found,expected).size()/(double)expected.size());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 nosqlbench
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.nosqlbench.engine.extensions.vectormath;
|
||||||
|
|
||||||
|
import com.codahale.metrics.MetricRegistry;
|
||||||
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@Service(value = ScriptingPluginInfo.class,selector = "vectormath")
|
||||||
|
public class VectorMathPluginInfo implements ScriptingPluginInfo<VectorMath> {
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "various methods and utilities for working with vector math in a scripted environment";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VectorMath getExtensionObject(Logger logger, MetricRegistry metricRegistry, LabeledScenarioContext scriptContext) {
|
||||||
|
return new VectorMath();
|
||||||
|
}
|
||||||
|
}
|
@ -18,12 +18,10 @@ package io.nosqlbench.adapters.api.activityimpl;
|
|||||||
|
|
||||||
import com.codahale.metrics.Histogram;
|
import com.codahale.metrics.Histogram;
|
||||||
import com.codahale.metrics.Timer;
|
import com.codahale.metrics.Timer;
|
||||||
|
import groovy.lang.Binding;
|
||||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||||
import io.nosqlbench.adapters.api.evalcontext.CycleFunction;
|
import io.nosqlbench.adapters.api.evalcontext.*;
|
||||||
import io.nosqlbench.adapters.api.evalcontext.CycleFunctions;
|
|
||||||
import io.nosqlbench.adapters.api.evalcontext.GroovyBooleanCycleFunction;
|
|
||||||
import io.nosqlbench.adapters.api.evalcontext.GroovyObjectEqualityFunction;
|
|
||||||
import io.nosqlbench.adapters.api.metrics.ThreadLocalNamedTimers;
|
import io.nosqlbench.adapters.api.metrics.ThreadLocalNamedTimers;
|
||||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||||
import io.nosqlbench.api.config.NBLabeledElement;
|
import io.nosqlbench.api.config.NBLabeledElement;
|
||||||
@ -51,6 +49,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>, NBLabeledElement {
|
public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>, NBLabeledElement {
|
||||||
private final static Logger logger = LogManager.getLogger(BaseOpDispenser.class);
|
private final static Logger logger = LogManager.getLogger(BaseOpDispenser.class);
|
||||||
public static final String VERIFIER = "verifier";
|
public static final String VERIFIER = "verifier";
|
||||||
|
public static final String VERIFIER_INIT = "verifier-init";
|
||||||
public static final String EXPECTED_RESULT = "expected-result";
|
public static final String EXPECTED_RESULT = "expected-result";
|
||||||
public static final String VERIFIER_IMPORTS = "verifier-imports";
|
public static final String VERIFIER_IMPORTS = "verifier-imports";
|
||||||
public static final String START_TIMERS = "start-timers";
|
public static final String START_TIMERS = "start-timers";
|
||||||
@ -97,8 +96,7 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
|
|||||||
this.configureInstrumentation(op);
|
this.configureInstrumentation(op);
|
||||||
this.configureVerifierImports(op);
|
this.configureVerifierImports(op);
|
||||||
List<CycleFunction<Boolean>> verifiers = new ArrayList<>();
|
List<CycleFunction<Boolean>> verifiers = new ArrayList<>();
|
||||||
verifiers.addAll(configureEqualityVerifier(op));
|
verifiers = configureVerifiers(op);
|
||||||
verifiers.addAll(configureAssertionVerifiers(op));
|
|
||||||
this._verifier = CycleFunctions.of((a, b) -> a && b, verifiers, true);
|
this._verifier = CycleFunctions.of((a, b) -> a && b, verifiers, true);
|
||||||
this.tlVerifier = ThreadLocal.withInitial(() -> _verifier.newInstance());
|
this.tlVerifier = ThreadLocal.withInitial(() -> _verifier.newInstance());
|
||||||
}
|
}
|
||||||
@ -123,35 +121,49 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<? extends CycleFunction<Boolean>> configureAssertionVerifiers(ParsedOp op) {
|
private List<CycleFunction<Boolean>> configureVerifiers(ParsedOp op) {
|
||||||
|
Binding variables = new Binding();
|
||||||
|
|
||||||
|
Map<String, ParsedTemplateString> initBlocks = op.getTemplateMap().takeAsNamedTemplates(VERIFIER_INIT);
|
||||||
|
List<CycleFunction<?>> verifierInitFunctions = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
initBlocks.forEach((initName, stringTemplate) -> {
|
||||||
|
GroovyCycleFunction<?> initFunction =
|
||||||
|
new GroovyCycleFunction<>(initName,stringTemplate,verifierImports,variables);
|
||||||
|
logger.info("configured verifier init:" + initFunction);
|
||||||
|
initFunction.setVariable("_parsed_op",op);
|
||||||
|
initFunction.apply(0L);
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new OpConfigError("error in verifier-init:" + e.getMessage(),e);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, ParsedTemplateString> namedVerifiers = op.getTemplateMap().takeAsNamedTemplates(VERIFIER);
|
Map<String, ParsedTemplateString> namedVerifiers = op.getTemplateMap().takeAsNamedTemplates(VERIFIER);
|
||||||
List<CycleFunction<Boolean>> verifierFunctions = new ArrayList<>();
|
List<CycleFunction<Boolean>> verifierFunctions = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
namedVerifiers.forEach((verifierName,stringTemplate) -> {
|
namedVerifiers.forEach((verifierName,stringTemplate) -> {
|
||||||
GroovyBooleanCycleFunction verifier =
|
GroovyBooleanCycleFunction verifier =
|
||||||
new GroovyBooleanCycleFunction(verifierName, stringTemplate, verifierImports);
|
new GroovyBooleanCycleFunction(verifierName, stringTemplate, verifierImports, variables);
|
||||||
logger.info("configured verifier:" + verifier);
|
logger.info("configured verifier:" + verifier);
|
||||||
verifierFunctions.add(verifier);
|
verifierFunctions.add(verifier);
|
||||||
});
|
});
|
||||||
return verifierFunctions;
|
|
||||||
} catch (Exception gre) {
|
} catch (Exception gre) {
|
||||||
throw new OpConfigError("error in verifier:" + gre.getMessage(), gre);
|
throw new OpConfigError("error in verifier:" + gre.getMessage(), gre);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private List<? extends CycleFunction<Boolean>> configureEqualityVerifier(ParsedOp op) {
|
|
||||||
try {
|
try {
|
||||||
return op.takeAsOptionalStringTemplate(EXPECTED_RESULT)
|
op.takeAsOptionalStringTemplate(EXPECTED_RESULT)
|
||||||
.map(tpl -> new GroovyObjectEqualityFunction(op.getName()+"-"+EXPECTED_RESULT, tpl, verifierImports))
|
.map(tpl -> new GroovyObjectEqualityFunction(op.getName()+"-"+EXPECTED_RESULT, tpl, verifierImports, variables))
|
||||||
.map(vl -> {
|
.map(vl -> {
|
||||||
logger.info("Configured equality verifier: " + vl);
|
logger.info("Configured equality verifier: " + vl);
|
||||||
return vl;
|
return vl;
|
||||||
})
|
})
|
||||||
.map(v -> List.of(v))
|
.ifPresent(verifierFunctions::add);
|
||||||
.orElse(List.of());
|
|
||||||
} catch (Exception gre) {
|
} catch (Exception gre) {
|
||||||
throw new OpConfigError("error in verifier:" + gre.getMessage(), gre);
|
throw new OpConfigError("error in verifier:" + gre.getMessage(), gre);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return verifierFunctions;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getOpName() {
|
String getOpName() {
|
||||||
|
@ -20,9 +20,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BinaryOperator;
|
import java.util.function.BinaryOperator;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CompoundCycleFunction<T> implements CycleFunction<T> {
|
public class CompoundCycleFunction<T> implements CycleFunction<T> {
|
||||||
|
|
||||||
private final List<CycleFunction<T>> functions = new ArrayList<>();
|
private final List<CycleFunction<T>> functions = new ArrayList<>();
|
||||||
private final BinaryOperator<T> reducer;
|
private final BinaryOperator<T> reducer;
|
||||||
|
|
||||||
@ -66,4 +66,10 @@ public class CompoundCycleFunction<T> implements CycleFunction<T> {
|
|||||||
function.setVariable(name, value);
|
function.setVariable(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.functions.size() + " cycle functions:\n" +
|
||||||
|
this.functions.stream().map(Object::toString).collect(Collectors.joining("\n","","\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,5 +55,12 @@ public class CycleFunctions {
|
|||||||
@Override
|
@Override
|
||||||
public <V> void setVariable(String name, V value) {
|
public <V> void setVariable(String name, V value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "NOOP(" + this.getExpressionDetails()+")";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,15 @@
|
|||||||
|
|
||||||
package io.nosqlbench.adapters.api.evalcontext;
|
package io.nosqlbench.adapters.api.evalcontext;
|
||||||
|
|
||||||
|
import groovy.lang.Binding;
|
||||||
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
|
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GroovyBooleanCycleFunction extends GroovyCycleFunction<Boolean> {
|
public class GroovyBooleanCycleFunction extends GroovyCycleFunction<Boolean> {
|
||||||
|
|
||||||
public GroovyBooleanCycleFunction(String name, ParsedTemplateString template, List<String> imports) {
|
public GroovyBooleanCycleFunction(String name, ParsedTemplateString template, List<String> imports, Binding binding) {
|
||||||
super(name, template, imports);
|
super(name, template, imports, binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,6 +20,8 @@ import groovy.lang.Binding;
|
|||||||
import groovy.lang.GroovyShell;
|
import groovy.lang.GroovyShell;
|
||||||
import groovy.lang.Script;
|
import groovy.lang.Script;
|
||||||
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
import io.nosqlbench.adapters.api.activityimpl.BaseOpDispenser;
|
||||||
|
import io.nosqlbench.api.extensions.SandboxExtensionFinder;
|
||||||
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.virtdata.core.bindings.Bindings;
|
import io.nosqlbench.virtdata.core.bindings.Bindings;
|
||||||
import io.nosqlbench.virtdata.core.bindings.BindingsTemplate;
|
import io.nosqlbench.virtdata.core.bindings.BindingsTemplate;
|
||||||
import io.nosqlbench.virtdata.core.templates.BindPoint;
|
import io.nosqlbench.virtdata.core.templates.BindPoint;
|
||||||
@ -37,6 +39,7 @@ public class GroovyCycleFunction<T> implements CycleFunction<T> {
|
|||||||
private final static Logger logger = LogManager.getLogger(GroovyBooleanCycleFunction.class);
|
private final static Logger logger = LogManager.getLogger(GroovyBooleanCycleFunction.class);
|
||||||
private final String name;
|
private final String name;
|
||||||
private final List<String> imports;
|
private final List<String> imports;
|
||||||
|
private final List<String> enabledServices = new ArrayList<>(List.of("vectormath"));
|
||||||
|
|
||||||
protected String scriptText; // Groovy script as provided
|
protected String scriptText; // Groovy script as provided
|
||||||
protected final Script script; // Groovy Script as compiled
|
protected final Script script; // Groovy Script as compiled
|
||||||
@ -45,34 +48,63 @@ public class GroovyCycleFunction<T> implements CycleFunction<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a cycle function from basic types
|
* Instantiate a cycle function from basic types
|
||||||
* @param scriptText The raw script text, not including any bind point or capture point syntax
|
*
|
||||||
* @param bindingSpecs The names and recipes of bindings which are referenced in the scriptText
|
* @param scriptText
|
||||||
* @param imports The package imports to be installed into the execution environment
|
* The raw script text, not including any bind point or capture point syntax
|
||||||
|
* @param bindingSpecs
|
||||||
|
* The names and recipes of bindings which are referenced in the scriptText
|
||||||
|
* @param imports
|
||||||
|
* The package imports to be installed into the execution environment
|
||||||
*/
|
*/
|
||||||
public GroovyCycleFunction(String name, String scriptText, Map<String,String> bindingSpecs, List<String> imports) {
|
public GroovyCycleFunction(String name, String scriptText, Map<String, String> bindingSpecs, List<String> imports, Binding binding) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.scriptText =scriptText;
|
this.scriptText = scriptText;
|
||||||
this.imports = imports;
|
this.imports = imports;
|
||||||
|
|
||||||
// scripting env variable bindings
|
// scripting env variable bindings
|
||||||
this.variableBindings = new Binding();
|
this.variableBindings = binding!=null? binding : new Binding();
|
||||||
|
|
||||||
// virtdata bindings to be evaluated at cycle time
|
// virtdata bindings to be evaluated at cycle time
|
||||||
this.bindingFunctions = new BindingsTemplate().addFieldBindings(bindingSpecs).resolveBindings();
|
this.bindingFunctions = new BindingsTemplate().addFieldBindings(bindingSpecs).resolveBindings();
|
||||||
|
|
||||||
this.script = compileScript(this.scriptText, imports);
|
this.script = compileScript(this.scriptText, imports, binding);
|
||||||
|
addServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroovyCycleFunction(String name, ParsedTemplateString template, List<String> imports) {
|
private void addServices() {
|
||||||
|
for (final ScriptingPluginInfo<?> extensionDescriptor : SandboxExtensionFinder.findAll()) {
|
||||||
|
if (!extensionDescriptor.isAutoLoading()) {
|
||||||
|
logger.info(() -> "Not loading " + extensionDescriptor + ", autoloading is false");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!enabledServices.isEmpty() && !enabledServices.contains(extensionDescriptor.getBaseVariableName())) {
|
||||||
|
logger.info(()->"Not loading " + extensionDescriptor + ", not included in subset.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final Logger extensionLogger =
|
||||||
|
LogManager.getLogger("extensions." + extensionDescriptor.getBaseVariableName());
|
||||||
|
final Object extensionObject = extensionDescriptor.getExtensionObject(
|
||||||
|
extensionLogger,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
logger.trace(() -> "Adding extension object: name=" + extensionDescriptor.getBaseVariableName() +
|
||||||
|
" class=" + extensionObject.getClass().getSimpleName());
|
||||||
|
setVariable(extensionDescriptor.getBaseVariableName(), extensionObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroovyCycleFunction(String name, ParsedTemplateString template, List<String> imports, Binding binding) {
|
||||||
this(
|
this(
|
||||||
name,
|
name,
|
||||||
template.getPositionalStatement(),
|
template.getPositionalStatement(),
|
||||||
resolveBindings(template.getBindPoints()),
|
resolveBindings(template.getBindPoints()),
|
||||||
imports
|
imports,
|
||||||
|
binding
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Script compileScript(String scriptText, List<String> imports) {
|
private Script compileScript(String scriptText, List<String> imports, Binding binding) {
|
||||||
// add classes which are in the imports to the groovy evaluation context
|
// add classes which are in the imports to the groovy evaluation context
|
||||||
String[] verifiedClasses = expandClassNames(imports);
|
String[] verifiedClasses = expandClassNames(imports);
|
||||||
|
|
||||||
@ -80,7 +112,7 @@ public class GroovyCycleFunction<T> implements CycleFunction<T> {
|
|||||||
ImportCustomizer importer = new ImportCustomizer().addImports(verifiedClasses);
|
ImportCustomizer importer = new ImportCustomizer().addImports(verifiedClasses);
|
||||||
compilerConfiguration.addCompilationCustomizers(importer);
|
compilerConfiguration.addCompilationCustomizers(importer);
|
||||||
|
|
||||||
GroovyShell gshell = new GroovyShell(new Binding(), compilerConfiguration);
|
GroovyShell gshell = new GroovyShell(binding!=null? binding:new Binding(), compilerConfiguration);
|
||||||
return gshell.parse(scriptText);
|
return gshell.parse(scriptText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,24 +154,30 @@ public class GroovyCycleFunction<T> implements CycleFunction<T> {
|
|||||||
@Override
|
@Override
|
||||||
public T apply(long value) {
|
public T apply(long value) {
|
||||||
Map<String, Object> values = bindingFunctions.getAllMap(value);
|
Map<String, Object> values = bindingFunctions.getAllMap(value);
|
||||||
values.forEach((k,v)-> variableBindings.setVariable(k,v));
|
values.forEach((k, v) -> variableBindings.setVariable(k, v));
|
||||||
T result= (T) script.run();
|
T result = (T) script.run();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an instance of an executable function which is based on the current one, with all of
|
||||||
|
* the per-cycle bindings as well as the variable bindings duplicated (shared).
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CycleFunction<T> newInstance() {
|
public CycleFunction<T> newInstance() {
|
||||||
return new GroovyCycleFunction<T>(name, scriptText, bindingFunctions,imports);
|
return new GroovyCycleFunction<T>(name, scriptText, bindingFunctions, imports, this.variableBindings.getVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
private GroovyCycleFunction(String name, String scriptText, Bindings bindingFunctions, List<String> imports) {
|
private GroovyCycleFunction(String name, String scriptText, Bindings bindingFunctions, List<String> imports, Map originalBinding) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.scriptText = scriptText;
|
this.scriptText = scriptText;
|
||||||
this.bindingFunctions = bindingFunctions;
|
this.bindingFunctions = bindingFunctions;
|
||||||
this.imports = imports;
|
this.imports = imports;
|
||||||
|
|
||||||
this.script = compileScript(scriptText,imports);
|
this.script = compileScript(scriptText, imports, new Binding());
|
||||||
this.variableBindings=script.getBinding();
|
this.variableBindings = script.getBinding();
|
||||||
|
originalBinding.forEach((k,v) -> variableBindings.setVariable(k.toString(),v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package io.nosqlbench.adapters.api.evalcontext;
|
package io.nosqlbench.adapters.api.evalcontext;
|
||||||
|
|
||||||
|
import groovy.lang.Binding;
|
||||||
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
|
import io.nosqlbench.virtdata.core.templates.ParsedTemplateString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -32,8 +33,8 @@ public class GroovyObjectEqualityFunction extends GroovyCycleFunction<Boolean> {
|
|||||||
|
|
||||||
private Object result;
|
private Object result;
|
||||||
|
|
||||||
public GroovyObjectEqualityFunction(String name, ParsedTemplateString template, List<String> imports) {
|
public GroovyObjectEqualityFunction(String name, ParsedTemplateString template, List<String> imports, Binding binding) {
|
||||||
super(name, template, imports);
|
super(name, template, imports, binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,8 +25,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
|
|
||||||
public class CompoundCycleFunctionTest {
|
public class CompoundCycleFunctionTest {
|
||||||
|
|
||||||
private final GroovyCycleFunction<Boolean> truthy = new GroovyCycleFunction<>("truthy", "true;", Map.of(), List.of());
|
private final GroovyCycleFunction<Boolean> truthy = new GroovyCycleFunction<>("truthy", "true;", Map.of(), List.of(),null);
|
||||||
private final GroovyCycleFunction<Boolean> falsy = new GroovyCycleFunction<>("falsy", "false;", Map.of(), List.of());
|
private final GroovyCycleFunction<Boolean> falsy = new GroovyCycleFunction<>("falsy", "false;", Map.of(), List.of(), null);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReducerFirstOrLastResult() {
|
public void testReducerFirstOrLastResult() {
|
||||||
|
@ -36,7 +36,7 @@ public class GroovyBooleanCycleFunctionTest {
|
|||||||
Map.of("numbername", "NumberNameToString()")
|
Map.of("numbername", "NumberNameToString()")
|
||||||
);
|
);
|
||||||
List<String> imports = List.of();
|
List<String> imports = List.of();
|
||||||
GroovyBooleanCycleFunction function = new GroovyBooleanCycleFunction("test1", parsedTemplate, imports);
|
GroovyBooleanCycleFunction function = new GroovyBooleanCycleFunction("test1", parsedTemplate, imports, null);
|
||||||
Boolean result = function.apply(2);
|
Boolean result = function.apply(2);
|
||||||
assertThat(result).isTrue();
|
assertThat(result).isTrue();
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class GroovyBooleanCycleFunctionTest {
|
|||||||
Map.of("numbername", "NumberNameToString()")
|
Map.of("numbername", "NumberNameToString()")
|
||||||
);
|
);
|
||||||
List<String> imports = List.of();
|
List<String> imports = List.of();
|
||||||
GroovyCycleFunction function = new GroovyBooleanCycleFunction("test2", parsedTemplate, imports);
|
GroovyCycleFunction function = new GroovyBooleanCycleFunction("test2", parsedTemplate, imports, null);
|
||||||
System.out.println(function);
|
System.out.println(function);
|
||||||
assertThatThrownBy(() -> function.apply(3L)).isInstanceOf(MissingPropertyException.class);
|
assertThatThrownBy(() -> function.apply(3L)).isInstanceOf(MissingPropertyException.class);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package io.nosqlbench.engine.api.activityimpl.uniform;
|
package io.nosqlbench.engine.api.activityimpl.uniform;
|
||||||
|
|
||||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||||
|
import io.nosqlbench.api.Shutdownable;
|
||||||
import io.nosqlbench.api.config.NBLabeledElement;
|
import io.nosqlbench.api.config.NBLabeledElement;
|
||||||
import io.nosqlbench.api.config.NBLabels;
|
import io.nosqlbench.api.config.NBLabels;
|
||||||
import io.nosqlbench.api.config.standard.*;
|
import io.nosqlbench.api.config.standard.*;
|
||||||
@ -194,7 +195,7 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This is done here since driver adapters are intended to keep all of their state within
|
* This is done here since driver adapters are intended to keep all of their state within
|
||||||
* dedicated <em>state space</em> types. Any space which implements {@link io.nosqlbench.engine.api.activityapi.core.Shutdownable}
|
* dedicated <em>state space</em> types. Any space which implements {@link Shutdownable}
|
||||||
* will be closed when this activity shuts down.
|
* will be closed when this activity shuts down.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -112,6 +112,7 @@ public class StandardAction<A extends StandardActivity<R, ?>, R extends Op> impl
|
|||||||
CycleFunction<Boolean> verifier = dispenser.getVerifier();
|
CycleFunction<Boolean> verifier = dispenser.getVerifier();
|
||||||
try {
|
try {
|
||||||
verifier.setVariable("result", result);
|
verifier.setVariable("result", result);
|
||||||
|
verifier.setVariable("cycle",cycle);
|
||||||
Boolean isGood = verifier.apply(cycle);
|
Boolean isGood = verifier.apply(cycle);
|
||||||
if (!isGood) {
|
if (!isGood) {
|
||||||
throw new ResultVerificationError("result verification failed", maxTries - tries, verifier.getExpressionDetails());
|
throw new ResultVerificationError("result verification failed", maxTries - tries, verifier.getExpressionDetails());
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.nosqlbench.engine.core.lifecycle.process;
|
package io.nosqlbench.engine.core.lifecycle.process;
|
||||||
|
|
||||||
import io.nosqlbench.engine.api.activityapi.core.Shutdownable;
|
import io.nosqlbench.api.Shutdownable;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
|||||||
import io.nosqlbench.api.metadata.ScenarioMetadata;
|
import io.nosqlbench.api.metadata.ScenarioMetadata;
|
||||||
import io.nosqlbench.api.metadata.ScenarioMetadataAware;
|
import io.nosqlbench.api.metadata.ScenarioMetadataAware;
|
||||||
import io.nosqlbench.api.metadata.SystemId;
|
import io.nosqlbench.api.metadata.SystemId;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.engine.api.scripting.ScriptEnvBuffer;
|
import io.nosqlbench.engine.api.scripting.ScriptEnvBuffer;
|
||||||
import io.nosqlbench.engine.core.annotation.Annotators;
|
import io.nosqlbench.engine.core.annotation.Annotators;
|
||||||
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
import io.nosqlbench.engine.core.lifecycle.ExecutionMetricsResult;
|
||||||
import io.nosqlbench.engine.core.lifecycle.activity.ActivityProgressIndicator;
|
import io.nosqlbench.engine.core.lifecycle.activity.ActivityProgressIndicator;
|
||||||
import io.nosqlbench.engine.core.lifecycle.scenario.script.SandboxExtensionFinder;
|
import io.nosqlbench.api.extensions.SandboxExtensionFinder;
|
||||||
import io.nosqlbench.engine.core.lifecycle.scenario.script.ScenarioContext;
|
import io.nosqlbench.engine.core.lifecycle.scenario.script.ScenarioContext;
|
||||||
import io.nosqlbench.engine.core.lifecycle.scenario.script.ScriptParams;
|
import io.nosqlbench.engine.core.lifecycle.scenario.script.ScriptParams;
|
||||||
import io.nosqlbench.engine.core.lifecycle.scenario.script.bindings.ActivityBindings;
|
import io.nosqlbench.engine.core.lifecycle.scenario.script.bindings.ActivityBindings;
|
||||||
|
@ -20,7 +20,7 @@ import com.codahale.metrics.*;
|
|||||||
import com.codahale.metrics.graphite.Graphite;
|
import com.codahale.metrics.graphite.Graphite;
|
||||||
import com.codahale.metrics.graphite.GraphiteReporter;
|
import com.codahale.metrics.graphite.GraphiteReporter;
|
||||||
import io.nosqlbench.api.engine.metrics.reporters.PromPushReporter;
|
import io.nosqlbench.api.engine.metrics.reporters.PromPushReporter;
|
||||||
import io.nosqlbench.engine.api.activityapi.core.Shutdownable;
|
import io.nosqlbench.api.Shutdownable;
|
||||||
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
||||||
import io.nosqlbench.engine.core.lifecycle.process.ShutdownManager;
|
import io.nosqlbench.engine.core.lifecycle.process.ShutdownManager;
|
||||||
import io.nosqlbench.api.engine.metrics.reporters.Log4JMetricsReporter;
|
import io.nosqlbench.api.engine.metrics.reporters.Log4JMetricsReporter;
|
||||||
|
@ -47,10 +47,10 @@
|
|||||||
<groupId>com.github.docker-java</groupId>
|
<groupId>com.github.docker-java</groupId>
|
||||||
<artifactId>docker-java-core</artifactId>
|
<artifactId>docker-java-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<!-- <groupId>com.fasterxml.jackson.core</groupId>-->
|
||||||
<artifactId>jackson-databind</artifactId>
|
<!-- <artifactId>jackson-databind</artifactId>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.docker-java</groupId>
|
<groupId>com.github.docker-java</groupId>
|
||||||
<artifactId>docker-java-transport-okhttp</artifactId>
|
<artifactId>docker-java-transport-okhttp</artifactId>
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.csvmetrics;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.csvoutput;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package io.nosqlbench.engine.extensions.example;
|
package io.nosqlbench.engine.extensions.example;
|
||||||
|
|
||||||
import io.nosqlbench.engine.api.extensions.SandboxPlugin;
|
import io.nosqlbench.api.extensions.SandboxPlugin;
|
||||||
|
|
||||||
public class ExamplePlugin implements SandboxPlugin {
|
public class ExamplePlugin implements SandboxPlugin {
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.example;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.files;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.globalvars;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import io.nosqlbench.virtdata.library.basics.core.threadstate.SharedState;
|
import io.nosqlbench.virtdata.library.basics.core.threadstate.SharedState;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.histologger;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.histostatslogger;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.http;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.optimizers;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.s3uploader;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import io.nosqlbench.api.metadata.ScenarioMetadata;
|
import io.nosqlbench.api.metadata.ScenarioMetadata;
|
||||||
import io.nosqlbench.api.metadata.ScenarioMetadataAware;
|
import io.nosqlbench.api.metadata.ScenarioMetadataAware;
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.extensions.scriptingmetrics;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ package io.nosqlbench.engine.shutdown;
|
|||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
import io.nosqlbench.api.extensions.ScriptingPluginInfo;
|
||||||
import io.nosqlbench.nb.annotations.Service;
|
import io.nosqlbench.nb.annotations.Service;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
||||||
<PROG>nb5</PROG>
|
<PROG>nb5</PROG>
|
||||||
|
<maven.plugin.validation>VERBOSE</maven.plugin.validation>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
@ -180,32 +181,11 @@
|
|||||||
<artifactId>lz4-java</artifactId>
|
<artifactId>lz4-java</artifactId>
|
||||||
<version>1.4.1</version>
|
<version>1.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- For CQL compression option -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.xerial.snappy</groupId>
|
|
||||||
<artifactId>snappy-java</artifactId>
|
|
||||||
<version>1.1.10.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.datastax.oss</groupId>
|
<groupId>com.datastax.oss</groupId>
|
||||||
<artifactId>java-driver-query-builder</artifactId>
|
<artifactId>java-driver-query-builder</artifactId>
|
||||||
<version>4.17.0</version>
|
<version>4.17.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.snakeyaml</groupId>
|
|
||||||
<artifactId>snakeyaml-engine</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.xerial.snappy</groupId>
|
|
||||||
<artifactId>snappy-java</artifactId>
|
|
||||||
<version>1.1.10.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.esri.geometry</groupId>
|
|
||||||
<artifactId>esri-geometry-api</artifactId>
|
|
||||||
<version>2.2.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-handler</artifactId>
|
<artifactId>netty-handler</artifactId>
|
||||||
@ -244,16 +224,6 @@
|
|||||||
<artifactId>commons-collections4</artifactId>
|
<artifactId>commons-collections4</artifactId>
|
||||||
<version>4.4</version>
|
<version>4.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.bouncycastle</groupId>
|
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
|
||||||
<version>1.69</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.15.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 nosqlbench
|
* Copyright (c) 2022-2023 nosqlbench
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package io.nosqlbench.engine.api.activityapi.core;
|
package io.nosqlbench.api;
|
||||||
|
|
||||||
public interface Shutdownable {
|
public interface Shutdownable {
|
||||||
void shutdown();
|
void shutdown();
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 nosqlbench
|
* Copyright (c) 2022-2023 nosqlbench
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -14,9 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.nosqlbench.engine.core.lifecycle.scenario.script;
|
package io.nosqlbench.api.extensions;
|
||||||
|
|
||||||
import io.nosqlbench.engine.api.extensions.ScriptingPluginInfo;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.nosqlbench.engine.api.extensions;
|
package io.nosqlbench.api.extensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Any object can be a sandbox extension. This is primarily a tagging interface.
|
* Any object can be a sandbox extension. This is primarily a tagging interface.
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.nosqlbench.engine.api.extensions;
|
package io.nosqlbench.api.extensions;
|
||||||
|
|
||||||
import com.codahale.metrics.MetricRegistry;
|
import com.codahale.metrics.MetricRegistry;
|
||||||
import io.nosqlbench.api.config.LabeledScenarioContext;
|
import io.nosqlbench.api.config.LabeledScenarioContext;
|
25
nbr/src/main/resources/examples/verifier/basic-verifier.yaml
Normal file
25
nbr/src/main/resources/examples/verifier/basic-verifier.yaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
scenarios:
|
||||||
|
default:
|
||||||
|
step1: run driver=stdout cycles=10
|
||||||
|
|
||||||
|
bindings:
|
||||||
|
number: Identity()
|
||||||
|
number_name: NumberNameToString()
|
||||||
|
|
||||||
|
ops:
|
||||||
|
vop1:
|
||||||
|
stmt: "number:{number} name:{number_name}\n"
|
||||||
|
verifier-imports:
|
||||||
|
- "io.nosqlbench.api.engine.metrics.ActivityMetrics"
|
||||||
|
verifier-init: |
|
||||||
|
recallHisto = ActivityMetrics.histogram(_parsed_op,"recall-histo",4);
|
||||||
|
verifier: |
|
||||||
|
if (recallHisto!=null) {
|
||||||
|
print("recallHisto is defined!\n");
|
||||||
|
recallHisto.update(cycle);
|
||||||
|
} else {
|
||||||
|
print("recallHisto is not defined!\n");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
// double recall = vectormath.computeRecall(result,result)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user