mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
engine and runtime updates for vector branch
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
package io.nosqlbench.engine.cli;
|
||||
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
import io.nosqlbench.adapters.api.templating.StrInterpolator;
|
||||
import io.nosqlbench.api.content.Content;
|
||||
import io.nosqlbench.api.content.NBIO;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -32,7 +32,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogDu
|
||||
import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogImporterUtility;
|
||||
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
||||
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawOpsLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.rawyaml.RawOpsLoader;
|
||||
import io.nosqlbench.engine.cli.NBCLIOptions.LoggerConfigData;
|
||||
import io.nosqlbench.engine.cli.NBCLIOptions.Mode;
|
||||
import io.nosqlbench.engine.core.annotation.Annotators;
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
|
||||
package io.nosqlbench.engine.cli;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.OpsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpsDocList;
|
||||
import io.nosqlbench.adapters.api.activityconfig.OpsLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
package io.nosqlbench.engine.core.lifecycle.activity;
|
||||
|
||||
import io.nosqlbench.engine.api.activityapi.core.*;
|
||||
import io.nosqlbench.engine.api.activityimpl.MotorState;
|
||||
import io.nosqlbench.api.annotations.Annotation;
|
||||
import io.nosqlbench.api.annotations.Layer;
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.api.engine.activityimpl.ParameterMap;
|
||||
import io.nosqlbench.engine.api.activityapi.core.*;
|
||||
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressCapable;
|
||||
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
|
||||
import io.nosqlbench.engine.api.activityimpl.motor.RunStateImage;
|
||||
@@ -41,7 +42,7 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* <p>In order to allow for dynamic thread management, which is not easily supported as an explicit feature
|
||||
* of most executor services, threads are started as long-running processes and managed via state signaling.
|
||||
* The {@link RunState} enum, {@link io.nosqlbench.engine.api.activityimpl.MotorState} type, and {@link RunStateTally}
|
||||
* The {@link RunState} enum, {@link MotorState} type, and {@link RunStateTally}
|
||||
* state tracking class are used together to represent valid states and transitions, contain and transition state atomically,
|
||||
* and provide blocking conditions for observers, respectively.</p>
|
||||
*
|
||||
|
||||
@@ -19,7 +19,7 @@ package io.nosqlbench.engine.core.lifecycle.activity;
|
||||
import io.nosqlbench.api.config.NBLabeledElement;
|
||||
import io.nosqlbench.engine.api.activityapi.core.ActivityType;
|
||||
import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.StandardActivityType;
|
||||
import io.nosqlbench.nb.annotations.Maturity;
|
||||
import io.nosqlbench.api.system.NBEnvironment;
|
||||
|
||||
@@ -199,8 +199,8 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
.allowAllAccess(true)
|
||||
.allowEnvironmentAccess(EnvironmentAccess.INHERIT)
|
||||
.allowPolyglotAccess(PolyglotAccess.ALL)
|
||||
.option("js.ecmascript-version", "2020")
|
||||
.option("js.nashorn-compat", "true");
|
||||
.option("js.ecmascript-version", "2022")
|
||||
.option("js.nashorn-compat", "false");
|
||||
|
||||
final Builder engineBuilder = org.graalvm.polyglot.Engine.newBuilder();
|
||||
engineBuilder.option("engine.WarnInterpreterOnly", "false");
|
||||
@@ -217,11 +217,6 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
this.scriptEngine.setContext(this.scriptEnv);
|
||||
|
||||
this.scriptEngine.put("params", this.scenarioScriptParams);
|
||||
|
||||
// scriptEngine.put("scenario", scenarioController);
|
||||
// scriptEngine.put("metrics", new PolyglotMetricRegistryBindings(metricRegistry));
|
||||
// scriptEngine.put("activities", new NashornActivityBindings(scenarioController));
|
||||
|
||||
this.scriptEngine.put("scenario", new PolyglotScenarioController(scenarioController));
|
||||
this.scriptEngine.put("metrics", new PolyglotMetricRegistryBindings(metricRegistry));
|
||||
this.scriptEngine.put("activities", new ActivityBindings(scenarioController));
|
||||
@@ -295,6 +290,7 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
public void notifyException(final Thread t, final Throwable e) {
|
||||
error = new RuntimeException("in thread " + t.getName() + ", " + e, e);
|
||||
}
|
||||
|
||||
private void executeScenarioScripts() {
|
||||
for (final String script : this.scripts)
|
||||
try {
|
||||
@@ -383,13 +379,13 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
|
||||
/**
|
||||
* This should be the only way to get a ScenarioResult for a Scenario.
|
||||
*
|
||||
* <p>
|
||||
* The lifecycle of a scenario includes the lifecycles of all of the following:
|
||||
* <OL>
|
||||
* <LI>The scenario control script, executing within a graaljs context.</LI>
|
||||
* <LI>The lifecycle of every activity which is started within the scenario.</LI>
|
||||
* </OL>
|
||||
*
|
||||
* <p>
|
||||
* All of these run asynchronously within the scenario, however the same thread that calls
|
||||
* the scenario is the one which executes the control script. A scenario ends when all
|
||||
* of the following conditions are met:
|
||||
@@ -410,8 +406,10 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
} finally {
|
||||
this.logger.debug("{} scenario run", null == this.error ? "NORMAL" : "ERRORED");
|
||||
}
|
||||
if (this.scriptEnv == null) {
|
||||
|
||||
final String iolog = this.scriptEnv.getTimedLog();
|
||||
}
|
||||
String iolog = error != null ? error.toString() : this.scriptEnv.getTimedLog();
|
||||
result = new ExecutionMetricsResult(startedAtMillis, endedAtMillis, iolog, this.error);
|
||||
this.result.reportMetricsSummaryToLog();
|
||||
this.doReportSummaries(this.reportSummaryTo, this.result);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -80,9 +80,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<groupId>org.apache.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>3.0.14</version>
|
||||
<version>4.0.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -352,7 +352,7 @@
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-runtime</artifactId>
|
||||
<version>4.12.0</version>
|
||||
<version>4.13.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -734,6 +734,7 @@
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/generated/**</exclude>
|
||||
<exclude>**/jmh_generated/**</exclude>
|
||||
</excludes>
|
||||
<addLicenseHeaders>true</addLicenseHeaders>
|
||||
<copyrightMessage>Copyright (c) 2022 nosqlbench</copyrightMessage>
|
||||
@@ -812,7 +813,7 @@
|
||||
<plugin>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<version>4.12.0</version>
|
||||
<version>4.13.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
|
||||
7
nbr/src/main/resources/examples/bindings-cqlvectors.yaml
Normal file
7
nbr/src/main/resources/examples/bindings-cqlvectors.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
scenarios:
|
||||
default:
|
||||
vectors: run driver=stdout cycles=10 threads=1 format=readout
|
||||
|
||||
bindings:
|
||||
hfv768raw: HashedFloatVectors(768); Stringify();
|
||||
hfv768cql: HashedFloatVectors(768); ToCqlVector();
|
||||
53
nbr/src/main/resources/examples/bindings-vectors.yaml
Normal file
53
nbr/src/main/resources/examples/bindings-vectors.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
scenarios:
|
||||
default:
|
||||
vectors: run driver=stdout cycles=10 threads=1 format=readout
|
||||
|
||||
bindings:
|
||||
|
||||
# create double and float vectors which high dispersion across the number
|
||||
# of dimensions specified. These are not yet enumerable, but they are
|
||||
# deterministic
|
||||
hdv1: HashedDoubleVectors(13); Stringify();
|
||||
hfv1: HashedFloatVectors(13); Stringify();
|
||||
|
||||
# specify the sizer function and the double function
|
||||
hdvn2: HashedDoubleVectors(long->HashRange(1,5)->int,long->HashRange(2.0d,3.0d)->double); NormalizeDoubleVector(); Stringify();
|
||||
|
||||
# specify the sizer function and the range of doubles to use
|
||||
hdv3: HashedDoubleVectors(long->HashRange(1,5)->int,long->HashRange(2.0d,3.0d)->double); Stringify();
|
||||
|
||||
hdv4: HashedDoubleVectors(13,0.0d,1.0d); Stringify();
|
||||
hfv4: HashedFloatVectors(13,0.0f,1.0f); Stringify();
|
||||
|
||||
|
||||
# create a simple 2-d vector from a step function over the unit interval
|
||||
# of 10 steps (the maximum number of characters per digit)
|
||||
v2d: DoubleVectors('0-2*2')
|
||||
|
||||
# use Stringify() to visualize the value of numeric array types
|
||||
v2d_str: DoubleVectors('0-2*2'); Stringify()
|
||||
|
||||
# normalize!
|
||||
v2dn: DoubleVectors('0-2*2'); NormalizeDoubleVector();
|
||||
|
||||
# normalize and stringify
|
||||
v2dn_str: DoubleVectors('0-2*2'); NormalizeDoubleVector(); Stringify();
|
||||
|
||||
# create a double vector based on 10 values per digit, by 10 digits.
|
||||
# this determines that the step function should be 0.1 per step, wrapping,
|
||||
# then maps this to a combinitoric model based on charset cardinality
|
||||
v1d: DoubleVectors('0-9*10');
|
||||
|
||||
v1dn: DoubleVectors('0-9*10'); NormalizeDoubleVector();
|
||||
|
||||
v1d_str: DoubleVectors('0-9*10'); Stringify();
|
||||
v1dn_str: DoubleVectors('0-9*10'); NormalizeDoubleVector(); Stringify();
|
||||
v1d_cql: DoubleVectors('0-9*10'); ToCqlVector();
|
||||
|
||||
v_09_10f: FloatVectors('0-9*10');
|
||||
unit_v_f_n: FloatVectors('0-9*10'); NormalizeFloatVector();
|
||||
v_az_3: DoubleVectors('a-z*3');
|
||||
unit_v_d_n: DoubleVectors('a-z*5'); NormalizeDoubleVector();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user