All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.facebook.presto.benchmark.framework.BenchmarkRunnerConfig Maven / Gradle / Ivy

There is a newer version: 0.290
Show newest version
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.benchmark.framework;

import com.facebook.airlift.configuration.Config;
import com.facebook.airlift.configuration.ConfigDescription;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;

import javax.validation.constraints.NotNull;

import java.util.Optional;
import java.util.Set;

import static com.facebook.presto.benchmark.source.DbBenchmarkSuiteSupplier.BENCHMARK_SUITE_SUPPLIER;

public class BenchmarkRunnerConfig
{
    private String testId;
    private String benchmarkSuiteSupplier = BENCHMARK_SUITE_SUPPLIER;
    private Set eventClients = ImmutableSet.of("json");
    private Optional jsonEventLogFile = Optional.empty();
    private boolean continueOnFailure;

    @NotNull
    public String getTestId()
    {
        return testId;
    }

    @Config("test-id")
    public BenchmarkRunnerConfig setTestId(String testId)
    {
        this.testId = testId;
        return this;
    }

    @NotNull
    public String getBenchmarkSuiteSupplier()
    {
        return benchmarkSuiteSupplier;
    }

    @Config("benchmark-suite-supplier")
    public BenchmarkRunnerConfig setBenchmarkSuiteSupplier(String benchmarkSuiteSupplier)
    {
        this.benchmarkSuiteSupplier = benchmarkSuiteSupplier;
        return this;
    }

    @NotNull
    public Set getEventClients()
    {
        return eventClients;
    }

    @ConfigDescription("The event client(s) to log the results to")
    @Config("event-clients")
    public BenchmarkRunnerConfig setEventClients(String eventClients)
    {
        this.eventClients = ImmutableSet.copyOf(Splitter.on(',').trimResults().omitEmptyStrings().splitToList(eventClients));
        return this;
    }

    @NotNull
    public Optional getJsonEventLogFile()
    {
        return jsonEventLogFile;
    }

    @ConfigDescription("The file to log json events. Used with event-clients=json. Print to standard output stream if not specified.")
    @Config("json.log-file")
    public BenchmarkRunnerConfig setJsonEventLogFile(String jsonEventLogFile)
    {
        this.jsonEventLogFile = Optional.ofNullable(jsonEventLogFile);
        return this;
    }

    public boolean isContinueOnFailure()
    {
        return continueOnFailure;
    }

    @Config("continue-on-failure")
    public BenchmarkRunnerConfig setContinueOnFailure(boolean continueOnFailure)
    {
        this.continueOnFailure = continueOnFailure;
        return this;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy