diff --git a/src/VirtualClient/VirtualClient.Actions/CoreMark/CoreMarkExecutor.cs b/src/VirtualClient/VirtualClient.Actions/CoreMark/CoreMarkExecutor.cs index 67bc74bef4..cd17f61b55 100644 --- a/src/VirtualClient/VirtualClient.Actions/CoreMark/CoreMarkExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/CoreMark/CoreMarkExecutor.cs @@ -114,6 +114,15 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel case PlatformID.Unix: using (IProcessProxy process = await this.ExecuteCommandAsync("make", argument, this.PackagePath, telemetryContext, cancellationToken)) { + if (!cancellationToken.IsCancellationRequested) + { + if (process.IsErrored()) + { + await this.LogProcessDetailsAsync(process, telemetryContext, "CoreMark", logToFile: true); + process.ThrowIfWorkloadFailed(errorReason: ErrorReason.CompilationFailed); + } + } + await this.CaptureMetricsAsync(process, argument, telemetryContext, cancellationToken); } @@ -125,6 +134,15 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel using (IProcessProxy process = await this.ExecuteCygwinBashAsync($"make {argument}", this.PackagePath, cygwinPackage.Path, telemetryContext, cancellationToken)) { + if (!cancellationToken.IsCancellationRequested) + { + if (process.IsErrored()) + { + await this.LogProcessDetailsAsync(process, telemetryContext, "CoreMark", logToFile: true); + process.ThrowIfWorkloadFailed(errorReason: ErrorReason.CompilationFailed); + } + } + await this.CaptureMetricsAsync(process, argument, telemetryContext, cancellationToken); } diff --git a/src/VirtualClient/VirtualClient.Actions/HPLinpack/HPLinpackExecutor.cs b/src/VirtualClient/VirtualClient.Actions/HPLinpack/HPLinpackExecutor.cs index 7c5a0a38ed..867a81787f 100644 --- a/src/VirtualClient/VirtualClient.Actions/HPLinpack/HPLinpackExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/HPLinpack/HPLinpackExecutor.cs @@ -209,15 +209,24 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel { using (BackgroundOperations profiling = BackgroundOperations.BeginProfiling(this, cancellationToken)) { + IProcessProxy process; + DateTime startTime = DateTime.UtcNow; - await this.ExecuteCommandAsync("make", $"arch=Linux_GCC", this.HPLDirectory, telemetryContext, cancellationToken) - .ConfigureAwait(false); + using (process = await this.ExecuteCommandAsync("make", $"arch=Linux_GCC", this.HPLDirectory, telemetryContext, cancellationToken).ConfigureAwait(false)) + { + if (!cancellationToken.IsCancellationRequested) + { + if (process.IsErrored()) + { + await this.LogProcessDetailsAsync(process, telemetryContext, "HPLinpack", logToFile: true); + process.ThrowIfWorkloadFailed(errorReason: ErrorReason.CompilationFailed); + } + } + } this.SetParameters(); await this.ConfigureDatFileAsync(telemetryContext, cancellationToken).ConfigureAwait(false); - IProcessProxy process; - if (this.cpuInfo.IsHyperthreadingEnabled) { this.commandArguments = $"--use-hwthread-cpus -np {this.NumberOfProcesses} --allow-run-as-root"; diff --git a/src/VirtualClient/VirtualClient.Actions/LAPACK/LAPACKExecutor.cs b/src/VirtualClient/VirtualClient.Actions/LAPACK/LAPACKExecutor.cs index c79f373bb3..37c6fb5071 100644 --- a/src/VirtualClient/VirtualClient.Actions/LAPACK/LAPACKExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/LAPACK/LAPACKExecutor.cs @@ -85,8 +85,17 @@ protected override async Task ExecuteAsync(EventContext telemetryContext, Cancel if (this.Platform == PlatformID.Unix) { // Run make to generate all object files for fortran subroutines. - await this.ExecuteCommandAsync("make", null, this.packageDirectory, cancellationToken) - .ConfigureAwait(false); + using (IProcessProxy process = await this.ExecuteCommandAsync("make", null, this.packageDirectory, telemetryContext, cancellationToken)) + { + if (!cancellationToken.IsCancellationRequested) + { + if (process.IsErrored()) + { + await this.LogProcessDetailsAsync(process, telemetryContext, "LAPACK", logToFile: true); + process.ThrowIfWorkloadFailed(errorReason: ErrorReason.CompilationFailed); + } + } + } // Delete results file that gets generated. if (this.fileSystem.File.Exists(this.ResultsFilePath)) diff --git a/src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs b/src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs index b38d20e8f9..774041d87c 100644 --- a/src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/LMbench/LMbenchExecutor.cs @@ -174,7 +174,7 @@ private Task BuildSourceCodeAsync(EventContext telemetryContext, CancellationTok if (!cancellationToken.IsCancellationRequested) { await this.LogProcessDetailsAsync(process, relatedContext, "LMbench_Build"); - process.ThrowIfErrored(errorReason: ErrorReason.WorkloadFailed); + process.ThrowIfErrored(errorReason: ErrorReason.CompilationFailed); } } }); diff --git a/src/VirtualClient/VirtualClient.Actions/Lzbench/LzbenchExecutor.cs b/src/VirtualClient/VirtualClient.Actions/Lzbench/LzbenchExecutor.cs index e7461c8573..c8f95a7dc9 100644 --- a/src/VirtualClient/VirtualClient.Actions/Lzbench/LzbenchExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Lzbench/LzbenchExecutor.cs @@ -136,7 +136,7 @@ protected override async Task InitializeAsync(EventContext telemetryContext, Can await this.ExecuteCommandAsync("git", $"clone -b v{this.Version} https://github.com/inikep/lzbench.git", this.PlatformSpecifics.PackagesDirectory, cancellationToken); // Build Lzbench. - await this.ExecuteCommandAsync("make", string.Empty, this.LzbenchDirectory, cancellationToken); + await this.ExecuteCommandAsync("make", string.Empty, this.LzbenchDirectory, cancellationToken, errorReason: ErrorReason.CompilationFailed); // Choose default file for compression and decompression if files/dirs are not provided. if (string.IsNullOrWhiteSpace(this.InputFilesOrDirs)) @@ -196,7 +196,7 @@ private async Task CaptureMetricsAsync(IProcessProxy process, string commandArgu } } - private async Task ExecuteCommandAsync(string pathToExe, string commandLineArguments, string workingDirectory, CancellationToken cancellationToken) + private async Task ExecuteCommandAsync(string pathToExe, string commandLineArguments, string workingDirectory, CancellationToken cancellationToken, ErrorReason errorReason = ErrorReason.WorkloadFailed) { if (!cancellationToken.IsCancellationRequested) { @@ -220,7 +220,7 @@ await process.StartAndWaitAsync(cancellationToken) await this.LogProcessDetailsAsync(process, telemetryContext) .ConfigureAwait(false); - process.ThrowIfErrored(errorReason: ErrorReason.WorkloadFailed); + process.ThrowIfErrored(errorReason: errorReason); } } }).ConfigureAwait(false); diff --git a/src/VirtualClient/VirtualClient.Actions/Memtier/MemtierBenchmarkClientExecutor.cs b/src/VirtualClient/VirtualClient.Actions/Memtier/MemtierBenchmarkClientExecutor.cs index c45532bb6d..7b750ee3b4 100644 --- a/src/VirtualClient/VirtualClient.Actions/Memtier/MemtierBenchmarkClientExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/Memtier/MemtierBenchmarkClientExecutor.cs @@ -513,7 +513,7 @@ private async Task ExecuteWorkloadAsync(PortDescription serverPort, string comma if (!cancellationToken.IsCancellationRequested) { await this.LogProcessDetailsAsync(process, telemetryContext, "Memtier", logToFile: true); - process.ThrowIfWorkloadFailed(MemcachedExecutor.SuccessExitCodes); + process.ThrowIfWorkloadFailed(MemcachedExecutor.SuccessExitCodes, errorReason: ErrorReason.CompilationFailed); // The Memtier workload for whatever reason emits the following statement in standard error: // 'Writing results to stdout'. We will throw if there is any other information in standard error. Certain diff --git a/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs b/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs index 975d0ca539..f30ec63998 100644 --- a/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs @@ -256,7 +256,7 @@ private async Task SetupSpecCpuAsync(string isoFilePath, EventContext telemetryC if (this.Platform == PlatformID.Unix) { await this.ExecuteCommandAsync("mount", $"-t iso9660 -o ro,exec,loop {isoFilePath} {mountPath}", this.PackageDirectory, telemetryContext, cancellationToken); - await this.ExecuteCommandAsync("./install.sh", $"-f -d {this.PackageDirectory}", mountPath, telemetryContext, cancellationToken); + await this.ExecuteCommandAsync("./install.sh", $"-f -d {this.PackageDirectory}", mountPath, telemetryContext, cancellationToken, ErrorReason.CompilationFailed); await this.WriteSpecCpuConfigAsync(cancellationToken); await this.ExecuteCommandAsync("chmod", $"-R ugo=rwx {this.PackageDirectory}", this.PackageDirectory, telemetryContext, cancellationToken); await this.ExecuteCommandAsync("umount", mountPath, this.PackageDirectory, telemetryContext, cancellationToken); @@ -289,7 +289,7 @@ private async Task SetupSpecCpuAsync(string isoFilePath, EventContext telemetryC await this.stateManager.SaveStateAsync($"{nameof(SpecCpuState)}", state, cancellationToken); } - private async Task ExecuteCommandAsync(string command, string commandArguments, string workingDirectory, EventContext telemetryContext, CancellationToken cancellationToken) + private async Task ExecuteCommandAsync(string command, string commandArguments, string workingDirectory, EventContext telemetryContext, CancellationToken cancellationToken, ErrorReason errorReason = ErrorReason.WorkloadFailed) { EventContext relatedContext = EventContext.Persisted() .AddContext(nameof(command), command) @@ -307,7 +307,7 @@ private async Task ExecuteCommandAsync(string command, string commandArg if (process.IsErrored()) { await this.LogProcessDetailsAsync(process, relatedContext, logToFile: true); - process.ThrowIfWorkloadFailed(); + process.ThrowIfWorkloadFailed(errorReason: errorReason); } } diff --git a/src/VirtualClient/VirtualClient.Contracts/Enumerations.cs b/src/VirtualClient/VirtualClient.Contracts/Enumerations.cs index c6dc604ac3..6456a153b0 100644 --- a/src/VirtualClient/VirtualClient.Contracts/Enumerations.cs +++ b/src/VirtualClient/VirtualClient.Contracts/Enumerations.cs @@ -37,14 +37,14 @@ public enum ErrorReason : int DiskFilterNotSupported = 301, /// - /// The workload failed during execution. + /// The workload results/results file was not found. /// - WorkloadFailed = 315, + WorkloadResultsNotFound = 314, /// - /// The workload results/results file was not found. + /// The workload failed during execution. /// - WorkloadResultsNotFound = 314, + WorkloadFailed = 315, /// /// The workload failed during execution. @@ -192,6 +192,11 @@ public enum ErrorReason : int /// InvalidOrMissingLicense = 512, + /// + /// Compilation of the workload failed. + /// + CompilationFailed = 513, + /// /// Disk format operations failed. ///