Skip to content

Commit

Permalink
HDDS-11494. Improve the duration option of freon ombg (apache#7246)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghuazhu authored Oct 1, 2024
1 parent 10d3b21 commit 360fea5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ public void init() {
//replace environment variables to support multi-node execution
prefix = resolvePrefix(prefix);
}
if (duration != null && !allowDuration()) {
LOG.warn("--duration is ignored");
duration = null;
}
if (duration != null) {
durationInSecond = TimeDurationUtil.getTimeDurationHelper(
"--runtime", duration, TimeUnit.SECONDS);
Expand Down Expand Up @@ -554,6 +558,15 @@ 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 MetricRegistry getMetrics() {
return metrics;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public class OmBucketGenerator extends BaseFreonGenerator

private Timer bucketCreationTimer;

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

@Override
public Void call() throws Exception {

Expand Down

0 comments on commit 360fea5

Please sign in to comment.