Search in sources :

Example 1 with ParameterMap

use of io.nosqlbench.engine.api.activityimpl.ParameterMap in project nosqlbench by nosqlbench.

the class ParameterMapTest method testGetOptional.

@Test
public void testGetOptional() {
    ParameterMap abc = ParameterMap.parseOrException("a=1;b=2;c=3;");
    Optional<Long> d = abc.getOptionalLong("d");
    assertThat(d).isEmpty();
    Optional<String> a = abc.getOptionalString("a");
    assertThat(a).isEqualTo(Optional.of("1"));
    Optional<Long> aLong = abc.getOptionalLong("a");
    assertThat(aLong).isEqualTo(Optional.of(1L));
}
Also used : ParameterMap(io.nosqlbench.engine.api.activityimpl.ParameterMap) Test(org.junit.jupiter.api.Test)

Example 2 with ParameterMap

use of io.nosqlbench.engine.api.activityimpl.ParameterMap in project nosqlbench by nosqlbench.

the class ScenarioController method start.

/**
 * Start an activity, given a map which holds the activity definition for it. The activity will be known in
 * the scenario by the alias parameter.
 *
 * @param activityDefMap A map containing the activity definition
 */
public synchronized void start(Map<String, String> activityDefMap) {
    ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
    start(ad);
}
Also used : ActivityDef(io.nosqlbench.engine.api.activityimpl.ActivityDef) ParameterMap(io.nosqlbench.engine.api.activityimpl.ParameterMap)

Example 3 with ParameterMap

use of io.nosqlbench.engine.api.activityimpl.ParameterMap in project nosqlbench by nosqlbench.

the class ScenarioController method stop.

/**
 * <p>Stop an activity, given an activity def map. The only part of the map that is important is the
 * alias parameter. This method retains the map signature to provide convenience for scripting.</p>
 *
 * @param activityDefMap A map, containing at least the alias parameter
 */
public synchronized void stop(Map<String, String> activityDefMap) {
    ActivityDef ad = new ActivityDef(new ParameterMap(activityDefMap));
    stop(ad);
}
Also used : ActivityDef(io.nosqlbench.engine.api.activityimpl.ActivityDef) ParameterMap(io.nosqlbench.engine.api.activityimpl.ParameterMap)

Example 4 with ParameterMap

use of io.nosqlbench.engine.api.activityimpl.ParameterMap in project nosqlbench by nosqlbench.

the class AsyncDiagAction method updateReportTime.

/**
 * assign the last append reference time and the interval which, when added to it, represent when this
 * diagnostic thread should take its turn to log cycle info. Also, append the modulo parameter.
 */
private void updateReportTime() {
    ParameterMap params = this.activity.getActivityDef().getParams();
    reportModulo = params.getOptionalLong("modulo").orElse(10000000L);
    lastUpdate = System.currentTimeMillis() - calculateOffset(slot, params);
    quantizedInterval = calculateInterval(params, activity.getActivityDef().getThreads());
    logger.trace("updating report time for slot:" + slot + ", def:" + params + " to " + quantizedInterval + ", and modulo " + reportModulo);
}
Also used : ParameterMap(io.nosqlbench.engine.api.activityimpl.ParameterMap)

Example 5 with ParameterMap

use of io.nosqlbench.engine.api.activityimpl.ParameterMap in project nosqlbench by nosqlbench.

the class AsyncDiagAction method onActivityDefUpdate.

@Override
public void onActivityDefUpdate(ActivityDef activityDef) {
    super.onActivityDefUpdate(activityDef);
    ParameterMap params = activityDef.getParams();
    updateReportTime();
    this.delayFunc = activity.getDelayFunc();
    this.resultFunc = activity.getResultFunc();
    this.erroroncycle = params.getOptionalLong("erroroncycle").orElse(Long.MIN_VALUE);
    this.throwoncycle = params.getOptionalLong("throwoncycle").orElse(Long.MIN_VALUE);
    this.logcycle = params.getOptionalBoolean("logcycle").orElse(false);
    this.diagRateLimiter = activity.getDiagRateLimiter();
    this.enableOutputProcessing = params.getOptionalBoolean("enable_output_processing").orElse(false);
}
Also used : ParameterMap(io.nosqlbench.engine.api.activityimpl.ParameterMap)

Aggregations

ParameterMap (io.nosqlbench.engine.api.activityimpl.ParameterMap)10 ActivityDef (io.nosqlbench.engine.api.activityimpl.ActivityDef)3 BasicError (io.nosqlbench.nb.api.errors.BasicError)1 InvalidParameterException (java.security.InvalidParameterException)1 Test (org.junit.jupiter.api.Test)1