update progress meter for readability

This commit is contained in:
Jonathan Shook 2022-06-28 19:48:38 -05:00
parent db327b29e9
commit 9a42b09b81
13 changed files with 99 additions and 118 deletions

View File

@ -7,15 +7,17 @@ description: |
population are replaced with new values which never repeat. During the main phase, random partitions are selected for
upsert, with row values never repeating.
version_regex: '4.17.*|5..+'
scenarios:
default:
schema: run driver=cql tags==phase:schema threads==1 cycles==UNDEF
rampup: run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
main: run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
schema: run driver=cql tags==block:schema threads==1 cycles==UNDEF
rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
main: run driver=cql tags==block:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
astra:
schema: run driver=cql tags==phase:schema-astra threads==1 cycles==UNDEF
rampup: run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
main: run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
schema: run driver=cql tags==block:schema-astra threads==1 cycles==UNDEF
rampup: run driver=cql tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
main: run driver=cql tags==block:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
bindings:
seq_key: Mod(<<keycount:1000000000>>); ToString() -> String
@ -24,86 +26,58 @@ bindings:
rw_value: Hash(); <<valdist:Uniform(0,1000000000)->int>>; ToString() -> String
blocks:
- name: schema
tags:
phase: schema
schema:
params:
prepared: false
statements:
- create-keyspace: |
ops:
create-keyspace: |
create keyspace if not exists <<keyspace:baselines>>
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '<<rf:1>>'}
AND durable_writes = true;
tags:
name: create-keyspace
- create-table: |
create-table: |
create table if not exists <<keyspace:baselines>>.<<table:keyvalue>> (
key text,
value text,
PRIMARY KEY (key)
);
tags:
name: create-table
- name: schema-astra
tags:
phase: schema-astra
schema-astra:
params:
prepared: false
statements:
- create-table: |
ops:
create-table: |
create table if not exists <<keyspace:baselines>>.<<table:keyvalue>> (
key text,
value text,
PRIMARY KEY (key)
);
tags:
name: create-table-astra
- name: rampup
tags:
phase: rampup
rampup:
params:
cl: <<write_cl:LOCAL_QUORUM>>
statements:
- rampup-insert: |
insert into <<keyspace:baselines>>.<<table:keyvalue>>
(key, value)
values ({seq_key},{seq_value});
tags:
name: rampup-insert
- name: verify
tags:
phase: verify
type: read
ops:
rampup-insert: |
insert into <<keyspace:baselines>>.<<table:keyvalue>>
(key, value)
values ({seq_key},{seq_value});
verify:
params:
cl: <<read_cl:LOCAL_QUORUM>>
statements:
- verify-select: |
select * from <<keyspace:baselines>>.<<table:keyvalue>> where key={seq_key};
ops:
verify-select: |
select * from <<keyspace:baselines>>.<<table:keyvalue>> where key={seq_key};
verify-fields: key->seq_key, value->seq_value
tags:
name: verify
- name: main-read
tags:
phase: main
type: read
space: "{{Combinations('A-C')}}"
main-read:
params:
ratio: 5
cl: <<read_cl:LOCAL_QUORUM>>
statements:
- main-select: |
select * from <<keyspace:baselines>>.<<table:keyvalue>> where key={rw_key};
tags:
name: main-select
- name: main-write
tags:
phase: main
type: write
ops:
main-select: |
select * from <<keyspace:baselines>>.<<table:keyvalue>> where key={rw_key};
main-write:
params:
ratio: 5
cl: <<write_cl:LOCAL_QUORUM>>
statements:
- main-insert: |
insert into <<keyspace:baselines>>.<<table:keyvalue>>
(key, value) values ({rw_key}, {rw_value});
tags:
name: main-insert
ops:
main-insert: |
insert into <<keyspace:baselines>>.<<table:keyvalue>>
(key, value) values ({rw_key}, {rw_value});

View File

@ -22,7 +22,7 @@ import io.nosqlbench.engine.api.util.Unit;
import java.time.Instant;
public class ActivityMetricProgressMeter implements ProgressMeter, CompletedMeter, RemainingMeter, ActiveMeter {
public class ActivityMetricProgressMeter implements ProgressMeterDisplay, CompletedMeter, RemainingMeter, ActiveMeter {
private final Activity activity;
private final Instant startInstant;

View File

@ -20,5 +20,5 @@ package io.nosqlbench.engine.api.activityapi.core.progress;
* Any type that implements this interface can provide a double indicating relative progress.
*/
public interface ProgressCapable {
ProgressMeter getProgressMeter();
ProgressMeterDisplay getProgressMeter();
}

View File

@ -20,13 +20,13 @@ import java.util.Arrays;
import java.util.stream.Collectors;
public class ProgressDisplay {
private final ProgressMeter[] meters;
private final ProgressMeterDisplay[] meters;
public ProgressDisplay(ProgressMeter... meters) {
public ProgressDisplay(ProgressMeterDisplay... meters) {
this.meters = meters;
}
public static CharSequence of(ProgressMeter... meters) {
public static CharSequence of(ProgressMeterDisplay... meters) {
return new ProgressDisplay(meters).toString();
}
@ -37,11 +37,11 @@ public class ProgressDisplay {
return meters[0].getSummary();
} else {
double total = 0d;
for (ProgressMeter meter : meters) {
for (ProgressMeterDisplay meter : meters) {
total += meter.getMaxValue();
}
return "PROGRESS:" + ProgressMeter.format(total / meters.length) + " (" +
Arrays.stream(meters).map(ProgressMeter::getSummary).collect(Collectors.joining(","));
return "PROGRESS:" + ProgressMeterDisplay.format(total / meters.length) + " (" +
Arrays.stream(meters).map(ProgressMeterDisplay::getSummary).collect(Collectors.joining(","));
}
}

View File

@ -19,7 +19,7 @@ package io.nosqlbench.engine.api.activityapi.core.progress;
import java.time.Instant;
import java.util.Locale;
public interface ProgressMeter {
public interface ProgressMeterDisplay {
String getProgressName();
Instant getStartTime();
@ -44,24 +44,33 @@ public interface ProgressMeter {
if (Double.isNaN(value)) {
return "Unknown";
}
return String.format(Locale.US, "%3f%%", (100.0 * value));
String formatted = String.format(Locale.US, "%03.0f%%", (100.0 * value));
return formatted;
}
default String getSummary() {
StringBuilder sb = new StringBuilder();
sb.append(getProgressName()).append(":").append(getRatioSummary());
StringBuilder legend = new StringBuilder(getProgressName()).append(" (");
StringBuilder values = new StringBuilder("(");
if (this instanceof CompletedMeter completed) {
sb.append(" completed:").append(completed.getCompletedCount());
}
if (this instanceof RemainingMeter pending) {
sb.append(" remaining:").append(pending.getRemainingCount());
if (this instanceof RemainingMeter remaining) {
legend.append("remaining,");
values.append(String.format("%.0f,",remaining.getRemainingCount()));
}
if (this instanceof ActiveMeter active) {
sb.append(" active:").append(active.getActiveOps());
legend.append("active,");
values.append(String.format("%.0f,",active.getActiveOps()));
}
return sb.toString();
if (this instanceof CompletedMeter completed) {
legend.append("completed,");
values.append(String.format("%.0f,",completed.getCompletedCount()));
}
legend.setLength(legend.length()-1);
values.setLength(values.length()-1);
// legend.append(" ETA:").append(getETAInstant());
String formatted = legend.append(")=").append(values).append(") ").append(getRatioSummary()).toString();
return formatted;
}
default long getProgressETAMillis() {

View File

@ -20,7 +20,7 @@ import com.codahale.metrics.Timer;
import io.nosqlbench.engine.api.activityapi.core.*;
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.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityapi.cyclelog.filters.IntPredicateDispenser;
import io.nosqlbench.engine.api.activityapi.errorhandling.ErrorMetrics;
import io.nosqlbench.engine.api.activityapi.errorhandling.modular.NBErrorHandler;
@ -40,7 +40,6 @@ import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
import io.nosqlbench.engine.api.templating.CommandTemplate;
import io.nosqlbench.engine.api.templating.ParsedOp;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import io.nosqlbench.nb.api.errors.BasicError;
import io.nosqlbench.nb.api.errors.OpConfigError;
@ -581,7 +580,7 @@ public class SimpleActivity implements Activity, ProgressCapable {
}
@Override
public synchronized ProgressMeter getProgressMeter() {
public synchronized ProgressMeterDisplay getProgressMeter() {
if (progressMeter == null) {
this.progressMeter = new ActivityMetricProgressMeter(this);
}

View File

@ -18,7 +18,7 @@ package io.nosqlbench.engine.api.activityimpl.input;
import io.nosqlbench.engine.api.activityapi.core.ActivityDefObserver;
import io.nosqlbench.engine.api.activityapi.core.progress.CycleMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressCapable;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleSegment;
import io.nosqlbench.engine.api.activityapi.input.Input;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
@ -150,11 +150,11 @@ public class AtomicInput implements Input, ActivityDefObserver, ProgressCapable
}
@Override
public ProgressMeter getProgressMeter() {
public ProgressMeterDisplay getProgressMeter() {
return new AtomicInputProgress(activityDef.getAlias(), this);
}
private static class AtomicInputProgress implements ProgressMeter, CycleMeter {
private static class AtomicInputProgress implements ProgressMeterDisplay, CycleMeter {
private final AtomicInput input;
private final String name;

View File

@ -17,7 +17,7 @@ package io.nosqlbench.engine.core.lifecycle;
import io.nosqlbench.engine.api.activityapi.core.*;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressCapable;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import io.nosqlbench.engine.core.annotation.Annotators;
@ -553,7 +553,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
}
@Override
public ProgressMeter getProgressMeter() {
public ProgressMeterDisplay getProgressMeter() {
return this.activity.getProgressMeter();
}

View File

@ -17,7 +17,7 @@
package io.nosqlbench.engine.core.lifecycle;
import io.nosqlbench.engine.api.activityapi.core.RunState;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityapi.core.progress.StateCapable;
import io.nosqlbench.engine.api.metrics.IndicatorMode;
import io.nosqlbench.engine.api.metrics.PeriodicRunnable;
@ -76,8 +76,8 @@ public class ActivityProgressIndicator implements Runnable {
@Override
public void run() {
Collection<ProgressMeter> progressMeters = sc.getProgressMeters();
for (ProgressMeter meter : progressMeters) {
Collection<ProgressMeterDisplay> progressMeterDisplays = sc.getProgressMeters();
for (ProgressMeterDisplay meter : progressMeterDisplays) {
boolean lastReport = false;
if (meter.getRatioComplete() >= 1.0d ||

View File

@ -18,7 +18,7 @@ package io.nosqlbench.engine.core.lifecycle;
import io.nosqlbench.engine.api.activityapi.core.Activity;
import io.nosqlbench.engine.api.activityapi.core.ActivityType;
import io.nosqlbench.engine.api.activityapi.core.RunState;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
@ -510,12 +510,12 @@ public class ScenarioController {
return activityMap;
}
public List<ProgressMeter> getProgressMeters() {
List<ProgressMeter> indicators = new ArrayList<>();
public List<ProgressMeterDisplay> getProgressMeters() {
List<ProgressMeterDisplay> indicators = new ArrayList<>();
for (ActivityExecutor ae : activityExecutors.values()) {
indicators.add(ae.getProgressMeter());
}
indicators.sort(Comparator.comparing(ProgressMeter::getStartTime));
indicators.sort(Comparator.comparing(ProgressMeterDisplay::getStartTime));
return indicators;
}

View File

@ -18,7 +18,7 @@ package io.nosqlbench.engine.rest.transfertypes;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.core.lifecycle.ScenarioResult;
import io.nosqlbench.engine.core.script.Scenario;
@ -72,9 +72,9 @@ public class LiveScenarioView {
return progressView;
}
Collection<? extends ProgressMeter> meters = scenario.getScenarioController().getProgressMeters();
for (ProgressMeter progressMeter : meters) {
ProgressView meterView = new ProgressView(progressMeter);
Collection<? extends ProgressMeterDisplay> meters = scenario.getScenarioController().getProgressMeters();
for (ProgressMeterDisplay progressMeterDisplay : meters) {
ProgressView meterView = new ProgressView(progressMeterDisplay);
progressView.add(meterView);
}

View File

@ -18,44 +18,44 @@ package io.nosqlbench.engine.rest.transfertypes;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.nosqlbench.engine.api.activityapi.core.progress.CycleMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeter;
import io.nosqlbench.engine.api.activityapi.core.progress.ProgressMeterDisplay;
import io.nosqlbench.engine.api.activityapi.core.progress.StateCapable;
public class ProgressView {
private final ProgressMeter progressMeter;
private final ProgressMeterDisplay progressMeterDisplay;
public ProgressView(ProgressMeter progressMeter) {
if (progressMeter==null) {
public ProgressView(ProgressMeterDisplay progressMeterDisplay) {
if (progressMeterDisplay ==null) {
throw new RuntimeException("Unable to create a view with a null progressMeter");
}
this.progressMeter = progressMeter;
this.progressMeterDisplay = progressMeterDisplay;
}
@JsonProperty("summary")
public String getProgressDetails() {
return progressMeter.getSummary();
return progressMeterDisplay.getSummary();
}
@JsonProperty("min")
public double getMin() {
return progressMeter.getMinValue();
return progressMeterDisplay.getMinValue();
}
@JsonProperty("current")
public double getCurrent() {
return progressMeter.getCurrentValue();
return progressMeterDisplay.getCurrentValue();
}
@JsonProperty("max")
public double getMax() {
return progressMeter.getMaxValue();
return progressMeterDisplay.getMaxValue();
}
@JsonProperty("recycles_max")
public double getRecyclesMax() {
if (progressMeter instanceof CycleMeter cm) {
if (progressMeterDisplay instanceof CycleMeter cm) {
return cm.getRecyclesMax();
} else {
return Double.NaN;
@ -64,7 +64,7 @@ public class ProgressView {
@JsonProperty("recycles_current")
public double getRecyclesCurrent() {
if (progressMeter instanceof CycleMeter cm) {
if (progressMeterDisplay instanceof CycleMeter cm) {
return cm.getRecyclesCurrent();
} else {
return Double.NaN;
@ -73,23 +73,23 @@ public class ProgressView {
@JsonProperty("eta_millis")
public double getEtaMills() {
return progressMeter.getProgressETAMillis();
return progressMeterDisplay.getProgressETAMillis();
}
@JsonProperty("name")
public String getName() {
return progressMeter.getProgressName();
return progressMeterDisplay.getProgressName();
}
@JsonProperty("completed")
public double getProgress() {
return progressMeter.getRatioComplete();
return progressMeterDisplay.getRatioComplete();
}
@JsonProperty("state")
public String getState() {
if (progressMeter instanceof StateCapable) {
return ((StateCapable)progressMeter).getRunState().toString();
if (progressMeterDisplay instanceof StateCapable) {
return ((StateCapable) progressMeterDisplay).getRunState().toString();
} else {
return "unknown";
}

View File

@ -41,7 +41,6 @@
<jaxb.core.version>2.3.0.1</jaxb.core.version>
<jaxb.impl.version>2.4.0-b180830.0438</jaxb.impl.version>
<joda.time.version>2.10.14</joda.time.version>
<jmh.version>1.34</jmh.version>
<lz4.version>1.4.1</lz4.version>
<!-- <metrics.version>4.0.7</metrics.version>-->
@ -149,12 +148,12 @@
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
<version>1.35</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<version>1.35</version>
</dependency>
<dependency>