mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
cleanups and formatting
This commit is contained in:
@@ -338,7 +338,8 @@ public class SimpleActivity implements Activity {
|
||||
* length of the sequence as determined by the provided ratios. Also, modify the ActivityDef with reasonable
|
||||
* defaults when requested.
|
||||
*
|
||||
* @param seq - The {@link OpSequence} to derive the defaults from
|
||||
* @param seq
|
||||
* - The {@link OpSequence} to derive the defaults from
|
||||
*/
|
||||
public synchronized void setDefaultsFromOpSequence(OpSequence<?> seq) {
|
||||
Optional<String> strideOpt = getParams().getOptionalString("stride");
|
||||
@@ -426,11 +427,11 @@ public class SimpleActivity implements Activity {
|
||||
/**
|
||||
* Given a function that can create an op of type <O> from a CommandTemplate, generate
|
||||
* an indexed sequence of ready to call operations.
|
||||
*
|
||||
* <p>
|
||||
* This method works almost exactly like the ,
|
||||
* except that it uses the {@link CommandTemplate} semantics, which are more general and allow
|
||||
* for map-based specification of operations with bindings in each field.
|
||||
*
|
||||
* <p>
|
||||
* It is recommended to use the CommandTemplate form
|
||||
* than the
|
||||
*
|
||||
@@ -590,7 +591,7 @@ public class SimpleActivity implements Activity {
|
||||
/**
|
||||
* Given a function that can create an op of type <O> from an OpTemplate, generate
|
||||
* an indexed sequence of ready to call operations.
|
||||
*
|
||||
* <p>
|
||||
* This method uses the following conventions to derive the sequence:
|
||||
*
|
||||
* <OL>
|
||||
@@ -604,8 +605,10 @@ public class SimpleActivity implements Activity {
|
||||
* where the sequence length is the sum of the ratios.</LI>
|
||||
* </OL>
|
||||
*
|
||||
* @param <O> A holder for an executable operation for the native driver used by this activity.
|
||||
* @param opinit A function to map an OpTemplate to the executable operation form required by
|
||||
* @param <O>
|
||||
* A holder for an executable operation for the native driver used by this activity.
|
||||
* @param opinit
|
||||
* A function to map an OpTemplate to the executable operation form required by
|
||||
* the native driver for this activity.
|
||||
* @param defaultAdapter
|
||||
* @return The sequence of operations as determined by filtering and ratios
|
||||
@@ -670,7 +673,6 @@ public class SimpleActivity implements Activity {
|
||||
} catch (Exception e) {
|
||||
throw new OpConfigError("Error loading op templates: " + e, workloadSource, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,15 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityimpl.uniform;
|
||||
|
||||
import io.nosqlbench.adapters.api.activityconfig.OpsLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.api.Shutdownable;
|
||||
import io.nosqlbench.api.config.NBLabeledElement;
|
||||
import io.nosqlbench.api.config.NBLabels;
|
||||
@@ -25,15 +33,7 @@ import io.nosqlbench.api.engine.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
|
||||
import io.nosqlbench.adapters.api.activityconfig.OpsLoader;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.adapters.api.activityconfig.yaml.OpsDocList;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpDispenser;
|
||||
import io.nosqlbench.adapters.api.activityimpl.OpMapper;
|
||||
import io.nosqlbench.engine.api.activityimpl.SimpleActivity;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.decorators.SyntheticOpTemplateProvider;
|
||||
import io.nosqlbench.adapters.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.adapters.api.templating.ParsedOp;
|
||||
import io.nosqlbench.nb.annotations.ServiceSelector;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -152,6 +152,7 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
|
||||
setDefaultsFromOpSequence(sequence);
|
||||
}
|
||||
|
||||
|
||||
public OpSequence<OpDispenser<? extends Op>> getOpSequence() {
|
||||
return sequence;
|
||||
}
|
||||
|
||||
@@ -210,7 +210,6 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
|
||||
final String reportPromPushTo = globalOptions.wantsReportPromPushTo();
|
||||
|
||||
|
||||
|
||||
final int mOpts = (dockerMetrics ? 1 : 0)
|
||||
+ ((null != dockerMetricsAt) ? 1 : 0)
|
||||
+ ((null != reportGraphiteTo) ? 1 : 0);
|
||||
|
||||
@@ -80,7 +80,6 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
return Optional.ofNullable(result);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NBLabels getLabels() {
|
||||
return this.parentComponent.getLabels().andTypes("scenario", this.scenarioName);
|
||||
@@ -142,15 +141,6 @@ public class Scenario implements Callable<ExecutionMetricsResult>, NBLabeledElem
|
||||
return new Scenario(name, null, engine, "console:10s", true, true, reportSummaryTo, "", Path.of("logs"), minMaturity, NBLabeledElement.forKV("test-name", "name"));
|
||||
}
|
||||
|
||||
// public Scenario(final String name, final Engine engine, final String reportSummaryTo, final Maturity minMaturity) {
|
||||
// scenarioName = name;
|
||||
// this.reportSummaryTo = reportSummaryTo;
|
||||
// this.engine = engine;
|
||||
// commandLine = "";
|
||||
// this.minMaturity = minMaturity;
|
||||
// logsPath = Path.of("logs");
|
||||
// }
|
||||
//
|
||||
public Scenario setLogger(final Logger logger) {
|
||||
this.logger = logger;
|
||||
return this;
|
||||
|
||||
@@ -48,79 +48,4 @@ public interface NBLabeledElement extends NBComponent {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// NBLabeledElement EMPTY = forMap(Map.of());
|
||||
//
|
||||
// Map<String, String> getLabels();
|
||||
//
|
||||
// /**
|
||||
// * TODO: Should throw an error when new keys are duplicated
|
||||
// * @param keyvalues
|
||||
// * @return
|
||||
// */
|
||||
// default Map<String, String> getLabelsAnd(final String... keyvalues) {
|
||||
// final LinkedHashMap<String, String> map = new LinkedHashMap<>(this.getLabels());
|
||||
// for (int idx = 0; idx < keyvalues.length; idx+=2) map.put(keyvalues[idx], keyvalues[idx + 1]);
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
//// default NBLabeledElement and(String... keyvalues) {
|
||||
////
|
||||
//// }
|
||||
//
|
||||
// default Map<String, String> getLabelsAnd(final Map<String,String> extra) {
|
||||
// final LinkedHashMap<String,String> map = new LinkedHashMap<>(this.getLabels());
|
||||
// map.putAll(extra);
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
// static MapLabels forMap(final Map<String,String> labels) {
|
||||
// return new MapLabels(labels);
|
||||
// }
|
||||
//
|
||||
// class MapLabels implements NBLabeledElement {
|
||||
// private final Map<String, String> labels;
|
||||
//
|
||||
// public MapLabels(final Map<String,String> labels) {
|
||||
// this.labels = labels;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, String> getLabels() {
|
||||
// return this.labels;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Create a single String representation of the label set, preserving key order,
|
||||
// * with optional additional labels, in the form of:
|
||||
// * <pre>{@code
|
||||
// * key1:value1,key2:value2,...
|
||||
// * }</pre>
|
||||
// * @param and
|
||||
// * @return
|
||||
// */
|
||||
// default String linearizeLabels(final Map<String,String> and) {
|
||||
// final StringBuilder sb= new StringBuilder();
|
||||
// final Map<String, String> allLabels = getLabelsAnd(and);
|
||||
// final ArrayList<String> sortedLabels = new ArrayList<>(allLabels.keySet());
|
||||
// for (final String label : sortedLabels) sb.append(label).append(':').append(allLabels.get(label)).append(',');
|
||||
// sb.setLength(sb.length()-",".length());
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Equivalent to {@link #linearizeLabels(Map)}, except that additional key-value pairs can
|
||||
// * be expressed as a pairs of Strings in the argument list.
|
||||
// * @param and - An even numbered list of strings as key1, value1, key2, value2, ...
|
||||
// * @return A linearized string representation
|
||||
// */
|
||||
// default String linearizeLabels(final String... and) {
|
||||
// return this.linearizeLabels(this.getLabelsAnd(and));
|
||||
// }
|
||||
//
|
||||
// default String linearizeLabelsByValueGraphite(final String... and) {
|
||||
// return this.linearizeLabelsByValueDelim(".",and);
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
@@ -131,14 +131,14 @@ public interface NBLabels {
|
||||
* @param labelName The named label to modify
|
||||
* @param transform A Lambda which will modify the existing value.
|
||||
* @return A new NBLabels value, separate from the original
|
||||
* @@throws RuntimeException if either the key is not found or the values is null.
|
||||
* @throws RuntimeException if either the key is not found or the values is null.
|
||||
*/
|
||||
NBLabels modifyValue(String labelName, Function<String,String> transform);
|
||||
|
||||
/**
|
||||
* Create a new NBLabels value with the additional keys and values appended.
|
||||
*
|
||||
* @param labelsAndValues
|
||||
* @param typeLabelsAndValues
|
||||
* Keys and values in "key1", "value1", "key2", "value2", ... form
|
||||
* @return A new NBLabels instance
|
||||
*/
|
||||
@@ -147,9 +147,7 @@ public interface NBLabels {
|
||||
NBLabels and(NBLabels labels);
|
||||
/**
|
||||
* Create a new NBLabels value with the additional keys and values appended.
|
||||
*
|
||||
* @param labels
|
||||
* a map of keys and values
|
||||
* @param typeLabelsAndValues a map of keys and values
|
||||
* @return A new NBLabels instance
|
||||
*/
|
||||
NBLabels andTypes(Map<String, String> typeLabelsAndValues);
|
||||
@@ -166,7 +164,7 @@ public interface NBLabels {
|
||||
* @throws RuntimeException
|
||||
* if the specified label does not exist in the set, or the value is null.
|
||||
*/
|
||||
String only(String name);
|
||||
String valueOf(String name);
|
||||
|
||||
/**
|
||||
* Return a map representation of the label set, regardless of the underlying form.
|
||||
|
||||
Reference in New Issue
Block a user