Skip to content

Commit

Permalink
Users/prachisingla/fix superbench issues (#148)
Browse files Browse the repository at this point in the history
* Fix Superbench issues

* Fixing few more things

* Fixing few more things

* Fixing local.ini file

* fic ini file

* local.ini file change

* local.ini file change

* updating git attributes to define eol

* Fixing tests

* Adding specific file to gitattributes

---------

Co-authored-by: Prachi Singla <[email protected]>
  • Loading branch information
psingla1210 and Prachi Singla authored Aug 11, 2023
1 parent 0cb60a4 commit 733ffb8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@
/src/VirtualClient/VirtualClient.Packaging/win-x64/SQLTPCC/HammerDB/**/* eol=lf
/src/VirtualClient/VirtualClient.Actions/**/*.sh eol=lf
/src/VirtualClient/VirtualClient.Dependencies/**/*.sh eol=lf
yarn.lock eol=lf
yarn.lock eol=lf
/src/VirtualClient/VirtualClient.Actions/SuperBenchmark/local.ini eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace VirtualClient.Actions
using System.IO.Abstractions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using VirtualClient.Common;
using VirtualClient.Common.Extensions;
Expand Down Expand Up @@ -159,7 +160,7 @@ protected override async Task InitializeAsync(EventContext telemetryContext, Can
string cloneDir = this.PlatformSpecifics.Combine(this.PlatformSpecifics.PackagesDirectory, "superbenchmark");
if (!this.fileSystem.Directory.Exists(cloneDir))
{
await this.ExecuteCommandAsync("git", $"clone -b v{this.Version} https://github.com/microsoft/superbenchmark", this.PlatformSpecifics.PackagesDirectory, telemetryContext, cancellationToken, runElevated: true);
await this.ExecuteSbCommandAsync("git", $"clone -b v{this.Version} https://github.com/microsoft/superbenchmark", this.PlatformSpecifics.PackagesDirectory, telemetryContext, cancellationToken, true);
}

foreach (string file in this.fileSystem.Directory.GetFiles(this.PlatformSpecifics.GetScriptPath("superbenchmark")))
Expand All @@ -170,15 +171,26 @@ protected override async Task InitializeAsync(EventContext telemetryContext, Can
true);
}

await this.ExecuteCommandAsync("bash", $"initialize.sh {this.Username}", this.SuperBenchmarkDirectory, telemetryContext, cancellationToken, runElevated: true);
await this.ExecuteCommandAsync("sb", $"deploy --host-list localhost -i {this.ContainerVersion}", this.SuperBenchmarkDirectory, telemetryContext, cancellationToken, runElevated: false);
await this.ExecuteSbCommandAsync("bash", $"initialize.sh {this.Username}", this.SuperBenchmarkDirectory, telemetryContext, cancellationToken, true);
await this.ExecuteSbCommandAsync("sb", $"deploy --host-list localhost -i {this.ContainerVersion}", this.SuperBenchmarkDirectory, telemetryContext, cancellationToken, false);

state.SuperBenchmarkInitialized = true;
}

await this.stateManager.SaveStateAsync<SuperBenchmarkState>($"{nameof(SuperBenchmarkState)}", state, cancellationToken);
}

private async Task ExecuteSbCommandAsync(string command, string commandArguments, string workingDirectory, EventContext telemetryContext, CancellationToken cancellationToken, bool runElevated)
{
IProcessProxy process = await this.ExecuteCommandAsync(command, commandArguments, workingDirectory, telemetryContext, cancellationToken, runElevated: runElevated);

if (!cancellationToken.IsCancellationRequested)
{
await this.LogProcessDetailsAsync(process, telemetryContext, "Superbench", logToFile: true);
process.ThrowIfWorkloadFailed();
}
}

private async Task CaptureMetricsAsync(IProcessProxy process, string commandArguments, EventContext telemetryContext, CancellationToken cancellationToken)
{
if (!cancellationToken.IsCancellationRequested)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[all]
localhost ansible_connection=local
localhost ansible_connection=local

0 comments on commit 733ffb8

Please sign in to comment.