apply superset config checking

This commit is contained in:
Jonathan Shook 2023-01-19 23:55:03 -06:00
parent dbf3df1e33
commit 90bcecc68e

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 nosqlbench
* Copyright (c) 2022-2023 nosqlbench
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -54,7 +54,6 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
public StandardActivity(ActivityDef activityDef) {
super(activityDef);
this.adapters.putAll(adapters);
Optional<String> yaml_loc = activityDef.getParams().getOptionalString("yaml", "workload");
if (yaml_loc.isPresent()) {
@ -69,11 +68,14 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
Optional<DriverAdapter> defaultAdapter = activityDef.getParams().getOptionalString("driver")
.flatMap(s -> ServiceSelector.of(s, adapterLoader).get());
// HERE, op templates are loaded before drivers are loaded
List<OpTemplate> opTemplates = loadOpTemplates(defaultAdapter);
List<ParsedOp> pops = new ArrayList<>();
List<DriverAdapter> adapterlist = new ArrayList<>();
NBConfigModel supersetConfig = ConfigModel.of(StandardActivity.class).add(yamlmodel);
for (OpTemplate ot : opTemplates) {
ParsedOp incompleteOpDef = new ParsedOp(ot, NBConfiguration.empty(), List.of());
String driverName = incompleteOpDef.takeOptionalStaticValue("driver", String.class)
@ -94,6 +96,8 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
if (adapter instanceof NBConfigurable configurable) {
NBConfigModel adapterModel = configurable.getConfigModel();
supersetConfig.add(adapterModel);
combinedModel = adapterModel.add(yamlmodel);
combinedConfig = combinedModel.matchConfig(activityDef.getParams());
configurable.applyConfig(combinedConfig);
@ -101,6 +105,8 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
adapters.put(driverName, adapter);
mappers.put(driverName, adapter.getOpMapper());
}
supersetConfig.assertValidConfig(activityDef.getParams().getStringStringMap());
DriverAdapter adapter = adapters.get(driverName);
adapterlist.add(adapter);