Skip to content
Snippets Groups Projects
Commit 83de527c authored by Marcel Samir Becker's avatar Marcel Samir Becker
Browse files

Execution yaml restructuring, strategy.name indicates strategy type

parent cbf2f3d2
No related branches found
No related tags found
1 merge request!215Redesign Strategy, Load, and Resources data types
This commit is part of merge request !215. Comments created here will be created in the context of that merge request.
......@@ -93,11 +93,12 @@ spec:
name: string
properties:
restrictions:
description: List of restriction strategys used to delimit the search space.
description: List of restriction strategies used to delimit the search space.
type: array
items:
type: string
guessStrategy: string
searchStrategy: object
properties:
duration:
description: Defines the duration of each experiment in seconds.
......
......@@ -59,6 +59,7 @@ class BenchmarkExecution : KubernetesResource {
lateinit var name: String
lateinit var restrictions: List<String>
lateinit var guessStrategy: String
lateinit var searchStrategy: String
}
/**
......
......@@ -92,7 +92,8 @@ class TheodoliteExecutor(
resourcePatcherDefinition
)
},
searchStrategy = strategyFactory.createSearchStrategy(executor, config.execution.strategy, results)
searchStrategy = strategyFactory.createSearchStrategy(executor, config.execution.strategy, results),
metric = config.execution.metric
)
}
......@@ -119,6 +120,10 @@ class TheodoliteExecutor(
val config = buildConfig()
//TODO: Differentiate metrics here
// when (config.metric) {
// "demand" -> // execute benchmarks for each load
// "capacity" -> // execute benchmarks for each resource amount
// }
// execute benchmarks for each load
try {
for (load in config.loads) {
......
......@@ -27,15 +27,21 @@ class StrategyFactory {
"FullSearch" -> FullSearch(executor)
"LinearSearch" -> LinearSearch(executor)
"BinarySearch" -> BinarySearch(executor)
"RestrictionSearch" -> when (searchStrategyObject.searchStrategy){
//TODO: Do we only need LinearSearch here as valid searchstrat? Or actually just allow all?
// If we dont have restriction Strat specified but still RestrictionSearch just do normal Search
"FullSearch" -> composeSearchRestrictionStrategy(executor, FullSearch(executor), results, searchStrategyObject.restrictions)
"LinearSearch" -> composeSearchRestrictionStrategy(executor, LinearSearch(executor), results, searchStrategyObject.restrictions)
"BinarySearch" -> composeSearchRestrictionStrategy(executor, BinarySearch(executor), results, searchStrategyObject.restrictions)
else -> throw IllegalArgumentException("Search Strategy ${searchStrategyObject.searchStrategy} for RestrictionSearch not found")
}
"InitialGuessSearch" -> when (searchStrategyObject.guessStrategy){
"PrevResourceMinGuess" -> InitialGuessSearchStrategy(executor,PrevResourceMinGuess(), results)
else -> throw IllegalArgumentException("Guess Strategy ${searchStrategyObject.guessStrategy} not found")
}
else -> throw IllegalArgumentException("Search Strategy $searchStrategyObject not found")
}
if(searchStrategyObject.restrictions.isNotEmpty()){
strategy = RestrictionSearch(executor,strategy,createRestrictionStrategy(results, searchStrategyObject.restrictions))
}
return strategy
}
......@@ -58,4 +64,21 @@ class StrategyFactory {
}
}.toSet()
}
/**
* Create a RestrictionSearch, if the provided restriction list is not empty. Otherwise just return the given
* searchStrategy.
*
* @param executor The [theodolite.execution.BenchmarkExecutor] that executes individual experiments.
* @param searchStrategy The [SearchStrategy] to use
* @param results The [Results] saves the state of the Theodolite benchmark run.
* @param restrictions The [RestrictionStrategy]'s to use
*/
private fun composeSearchRestrictionStrategy(executor: BenchmarkExecutor, searchStrategy: SearchStrategy,
results: Results, restrictions: List<String>): SearchStrategy {
if(restrictions.isNotEmpty()){
return RestrictionSearch(executor,searchStrategy,createRestrictionStrategy(results, restrictions))
}
return searchStrategy
}
}
......@@ -10,10 +10,12 @@ import theodolite.strategies.searchstrategy.SearchStrategy
* @param loads the [LoadDimension] of the execution
* @param resources the [Resource] of the execution
* @param searchStrategy the [SearchStrategy] of the execution
* @param metric the Metric of the execution
*/
@RegisterForReflection
data class Config(
val loads: List<LoadDimension>,
val resources: List<Resource>,
val searchStrategy: SearchStrategy
val searchStrategy: SearchStrategy,
val metric: String
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment