Skip to content

Commit

Permalink
resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nmalkapuram committed Nov 19, 2024
1 parent a6f133d commit d101531
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,10 @@ private async Task RunOLTPWorkloadAsync(EventContext telemetryContext, Cancellat
this.sysbenchLoggingArguments = $"--dbName {this.DatabaseName} --databaseSystem {this.DatabaseSystem} --benchmark {this.Benchmark} --workload {this.Workload} --threadCount {threadCount} --tableCount {tableCount} --recordCount {recordCount} ";
this.sysbenchExecutionArguments = this.sysbenchLoggingArguments + $"--hostIpAddress {this.ServerIpAddress} --durationSecs {this.Duration.TotalSeconds} --password {this.SuperUserPassword}";

string command = "python3";
string script = $"{this.SysbenchPackagePath}/run-workload.py ";

using (IProcessProxy process = await this.ExecuteCommandAsync(
command,
PythonCommand,
script + this.sysbenchExecutionArguments,
this.SysbenchPackagePath,
telemetryContext,
Expand All @@ -244,11 +243,10 @@ private async Task RunTPCCWorkloadAsync(EventContext telemetryContext, Cancellat
this.sysbenchLoggingArguments = $"--dbName {this.DatabaseName} --databaseSystem {this.DatabaseSystem} --benchmark {this.Benchmark} --workload tpcc --threadCount {threadCount} --tableCount {tableCount} --warehouses {warehouseCount} ";
this.sysbenchExecutionArguments = this.sysbenchLoggingArguments + $"--hostIpAddress {this.ServerIpAddress} --durationSecs {this.Duration.TotalSeconds} --password {this.SuperUserPassword}";

string command = "python3";
string script = $"{this.SysbenchPackagePath}/run-workload.py ";

using (IProcessProxy process = await this.ExecuteCommandAsync(
command,
PythonCommand,
script + this.sysbenchExecutionArguments,
this.SysbenchPackagePath,
telemetryContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,68 +113,6 @@ public bool InMemory
/// </summary>
protected ISystemManagement SystemManager { get; }

/*
/// <summary>
/// Client used to communicate with the hosted instance of the
/// Virtual Client API at server side.
/// </summary>
public IApiClient ServerApiClient { get; set; }*/

/*
/// <summary>
/// Server IpAddress on which MySQL Server runs.
/// </summary>
protected string ServerIpAddress { get; set; }
/// <summary>
/// Initializes the environment for execution of the Sysbench workload.
/// </summary>
protected override async Task InitializeAsync(EventContext telemetryContext, CancellationToken cancellationToken)
{
DependencyPath workloadPackage = await this.GetPackageAsync(this.PackageName, cancellationToken).ConfigureAwait(false);
workloadPackage.ThrowIfNull(this.PackageName);
DependencyPath package = await this.GetPlatformSpecificPackageAsync(this.PackageName, cancellationToken);
this.packageDirectory = package.Path;
this.InitializeApiClients(telemetryContext, cancellationToken);
if (this.IsMultiRoleLayout())
{
ClientInstance clientInstance = this.GetLayoutClientInstance();
string layoutIPAddress = clientInstance.IPAddress;
this.ThrowIfLayoutClientIPAddressNotFound(layoutIPAddress);
this.ThrowIfRoleNotSupported(clientInstance.Role);
}
}
/// <summary>
/// Initializes API client.
/// </summary>
protected void InitializeApiClients(EventContext telemetryContext, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
{
IApiClientManager clientManager = this.Dependencies.GetService<IApiClientManager>();
if (!this.IsMultiRoleLayout())
{
this.ServerIpAddress = IPAddress.Loopback.ToString();
this.ServerApiClient = clientManager.GetOrCreateApiClient(this.ServerIpAddress, IPAddress.Loopback);
}
else
{
ClientInstance serverInstance = this.GetLayoutClientInstances(ClientRole.Server).First();
IPAddress.TryParse(serverInstance.IPAddress, out IPAddress serverIPAddress);
this.ServerIpAddress = serverIPAddress.ToString();
this.ServerApiClient = clientManager.GetOrCreateApiClient(this.ServerIpAddress, serverIPAddress);
this.RegisterToSendExitNotifications($"{this.TypeName}.ExitNotification", this.ServerApiClient);
}
}
}*/

/// <summary>
/// Installs MySQL
/// </summary>
Expand All @@ -193,13 +131,6 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel
DependencyPath package = await this.GetPlatformSpecificPackageAsync(this.PackageName, cancellationToken);
this.packageDirectory = package.Path;

/*if (this.WaitForServer)
{
string serverstateId = $"{nameof(MySQLServerConfiguration)}-{this.Action}-action-success";
ConfigurationState configurationState = await this.stateManager.GetStateAsync<ConfigurationState>(serverstateId, cancellationToken)
.ConfigureAwait(false);
}*/

if (!this.SkipInitialize)
{
if (configurationState == null)
Expand Down Expand Up @@ -227,11 +158,6 @@ await this.DistributeMySQLDatabaseAsync(telemetryContext, cancellationToken)
await this.SetMySQLGlobalVariableAsync(telemetryContext, cancellationToken)
.ConfigureAwait(false);
}
else if (this.Action == ConfigurationAction.TruncateDatabase)
{
await this.TruncateMySQLDatabaseAsync(telemetryContext, cancellationToken)
.ConfigureAwait(false);
}
}
}

Expand Down Expand Up @@ -328,32 +254,6 @@ private async Task DistributeMySQLDatabaseAsync(EventContext telemetryContext, C
}
}

private async Task TruncateMySQLDatabaseAsync(EventContext telemetryContext, CancellationToken cancellationToken)
{
string arguments = $"{this.packageDirectory}/truncate-tables.py --dbName {this.DatabaseName}";

if (this.IsMultiRoleLayout())
{
ClientInstance instance = this.Layout.GetClientInstance(this.AgentId);
string serverIps = (instance.Role == ClientRole.Server) ? "localhost" : this.GetServerIpAddress();
arguments += $" --clientIps \"{serverIps}\"";
}

using (IProcessProxy process = await this.ExecuteCommandAsync(
PythonCommand,
arguments,
Environment.CurrentDirectory,
telemetryContext,
cancellationToken))
{
if (!cancellationToken.IsCancellationRequested)
{
await this.LogProcessDetailsAsync(process, telemetryContext, "MySQLServerConfiguration", logToFile: true);
process.ThrowIfDependencyInstallationFailed(process.StandardError.ToString());
}
}
}

private async Task<string> GetMySQLInnodbDirectoriesAsync(CancellationToken cancellationToken)
{
string diskPaths = string.Empty;
Expand Down Expand Up @@ -452,13 +352,7 @@ internal class ConfigurationAction
/// <summary>
/// Distributes existing database to disks on the system
/// </summary>
public const string DistributeDatabase = nameof(DistributeDatabase);

/// <summary>
/// Truncates all tables existing in database
/// </summary>
public const string TruncateDatabase = nameof(TruncateDatabase);

public const string DistributeDatabase = nameof(DistributeDatabase);
}

internal class ConfigurationState
Expand Down

0 comments on commit d101531

Please sign in to comment.