Skip to content

Commit

Permalink
use sane defaults for is_batch/is_flex/api_version based on the provider
Browse files Browse the repository at this point in the history
value
  • Loading branch information
motus committed Oct 5, 2023
1 parent d18eb78 commit c14832b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions mlos_bench/mlos_bench/services/remote/azure/azure_saas.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,34 @@ def __init__(self,
"subscription",
"resourceGroup",
"provider",
"supportsBatchUpdate",
"isFlex",
"apiVersion"
})

self._is_batch = self.config["supportsBatchUpdate"]
(self._is_batch, is_flex, api_version) = {
"Microsoft.DBforMySQL": (
self.config.get("supportsBatchUpdate", True),
self.config.get("isFlex", True),
self.config.get("apiVersion", "2022-01-01"),
),
"Microsoft.DBforMariaDB": (
self.config.get("supportsBatchUpdate", False),
self.config.get("isFlex", False),
self.config.get("apiVersion", "2018-06-01"),
),
"Microsoft.DBforPostgreSQL": (
self.config.get("supportsBatchUpdate", False),
self.config.get("isFlex", True),
self.config.get("apiVersion", "2022-12-01"),
),
}[self.config["provider"]]

self._url_config = self._URL_CONFIGURE.format(
subscription=self.config["subscription"],
resource_group=self.config["resourceGroup"],
provider=self.config["provider"],
vm_name="{vm_name}",
server_type="flexibleServers" if self.config["isFlex"] else "servers",
server_type="flexibleServers" if is_flex else "servers",
update="updateConfigurations" if self._is_batch else "configurations/{param_name}",
api_version=self.config["apiVersion"],
api_version=api_version,
)

# These parameters can come from command line as strings, so conversion is needed.
Expand Down

0 comments on commit c14832b

Please sign in to comment.