Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public void init() {
//replace environment variables to support multi-node execution
prefix = resolvePrefix(prefix);
}
if (duration != null) {
if (duration != null && allowDuration()) {
Comment thread
adoroszlai marked this conversation as resolved.
Outdated
durationInSecond = TimeDurationUtil.getTimeDurationHelper(
"--runtime", duration, TimeUnit.SECONDS);
if (durationInSecond <= 0) {
Expand Down Expand Up @@ -327,7 +327,7 @@ public void init() {
executor = Executors.newFixedThreadPool(threadNo);
long maxValue;
LongSupplier supplier;
if (duration != null) {
if (duration != null && allowDuration()) {
maxValue = durationInSecond;
supplier = () -> Duration.between(
Instant.ofEpochMilli(startTime), Instant.now()).getSeconds();
Expand Down Expand Up @@ -554,6 +554,19 @@ public String getPrefix() {
return prefix;
}

/**
* Whether to enable Duration.
* If enabled, the command will load the --duration option.
* If not enabled, the command will not load the --duration option.
*/
public boolean allowDuration() {
return true;
}

public String getDuration() {
return duration;
}

public MetricRegistry getMetrics() {
return metrics;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;

import com.codahale.metrics.Timer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

Expand All @@ -41,6 +43,8 @@
public class OmBucketGenerator extends BaseFreonGenerator
implements Callable<Void> {

private static final Logger LOG = LoggerFactory.getLogger(OmBucketGenerator.class);

@Option(names = {"-v", "--volume"},
description = "Name of the volume which contains the test data. Will be"
+ " created if missing.",
Expand All @@ -57,8 +61,16 @@ public class OmBucketGenerator extends BaseFreonGenerator

private Timer bucketCreationTimer;

@Override
public boolean allowDuration() {
return false;
}

@Override
public Void call() throws Exception {
if (getDuration() != null) {
LOG.warn("When running ombg, setting --duration has no effect.");
Comment thread
adoroszlai marked this conversation as resolved.
Outdated
}

init();

Expand Down