Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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 io.trino.benchto.driver;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import io.trino.benchto.driver.graphite.GraphiteProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkState;
import static io.trino.benchto.driver.utils.PropertiesUtils.extractPaths;
import static io.trino.benchto.driver.utils.PropertiesUtils.splitProperty;
import static java.util.stream.Collectors.toMap;
@Component
public class BenchmarkProperties
{
@Value("${sql}")
private String sqlDirs;
@Value("${benchmarks}")
private String benchmarksDirs;
@Value("${presto.url}")
private String prestoURL;
@Value("${presto.httpEventListenerPort:#{null}}")
private Integer prestoHttpEventListenerPort;
@Value("${presto.username:#{null}}")
private String prestoUsername;
@Value("${benchmark-service.url}")
private String serviceUrl;
@Value("${overrides:#{null}}")
private String overridesPath;
/**
* Active benchmarks. If this property is set benchmarks will be filtered by name.
*/
@Value("${activeBenchmarks:#{null}}")
private String activeBenchmarks;
/**
* Active variables. If this property is set benchmarks will be filtered by their variable content.
*/
@Value("${activeVariables:#{null}}")
private String activeVariables;
/**
* Execution identifiers. Every value must be unique for all environments. If not set, it will be automatically set based on timestamp.
*/
@Value("${executionSequenceId:#{null}}")
private String executionSequenceId;
@Value("${environment.name}")
private String environmentName;
@Value("${macroExecutions.healthCheck:#{null}}")
private String healthCheckMacros;
@Value("${queryRepetitionScope:BENCHMARK}")
private QueryRepetitionScope queryRepetitionScope;
@Value("${macroExecutions.beforeAll:#{null}}")
private String beforeAllMacros;
@Value("${macroExecutions.afterAll:#{null}}")
private String afterAllMacros;
@Value("${timeLimit:#{null}}")
private String timeLimit;
@Value("${frequencyCheckEnabled:true}")
private String frequencyCheckEnabled;
@Value("${query-results-dir}")
private String queryResultsDir;
@Value("${warmup:false}")
private String warmup;
@Autowired
private GraphiteProperties graphiteProperties;
public List sqlFilesDirs()
{
return extractPaths(sqlDirs);
}
public List benchmarksFilesDirs()
{
return extractPaths(benchmarksDirs);
}
public String getServiceURL()
{
return serviceUrl;
}
public String getPrestoURL()
{
return prestoURL;
}
public Optional getPrestoHttpEventListenerURL()
{
if (prestoHttpEventListenerPort == null) {
return Optional.empty();
}
return Optional.of(UriComponentsBuilder.fromUriString(prestoURL).port(prestoHttpEventListenerPort).build().toUriString());
}
public Optional getPrestoUsername()
{
return Optional.ofNullable(prestoUsername);
}
public Optional getOverridesPath()
{
return Optional.ofNullable(overridesPath).map(Paths::get);
}
public Optional> getExecutionSequenceId()
{
return splitProperty(executionSequenceId);
}
public String getEnvironmentName()
{
return environmentName;
}
public Optional> getActiveBenchmarks()
{
return splitProperty(activeBenchmarks);
}
public Optional