@@ -179,69 +179,28 @@ private Task ExecuteWorkloadAsync(EventContext telemetryContext, CancellationTok
179179 {
180180 using ( BackgroundOperations profiling = BackgroundOperations . BeginProfiling ( this , cancellationToken ) )
181181 {
182- switch ( this . Benchmark )
183- {
184- case BenchmarkName . OLTP :
185- await this . RunOLTPWorkloadAsync ( telemetryContext , cancellationToken ) ;
186- break ;
187- case BenchmarkName . TPCC :
188- await this . RunTPCCWorkloadAsync ( telemetryContext , cancellationToken ) ;
189- break ;
190- default :
191- throw new DependencyException (
192- $ "The '{ this . Benchmark } ' benchmark is not supported with the Sysbench workload. Supported options include: \" OLTP, TPCC\" .",
193- ErrorReason . NotSupported ) ;
194- }
195- }
196- } ) ;
197- }
198-
199- private async Task RunOLTPWorkloadAsync ( EventContext telemetryContext , CancellationToken cancellationToken )
200- {
201- this . sysbenchLoggingArguments = this . BuildSysbenchLoggingArguments ( prepare : false ) ;
202- this . sysbenchExecutionArguments = $ "{ this . sysbenchLoggingArguments } --workload { this . Workload } --hostIpAddress { this . ServerIpAddress } --durationSecs { this . Duration . TotalSeconds } --password { this . SuperUserPassword } ";
203-
204- string script = $ "{ this . SysbenchPackagePath } /run-workload.py ";
205-
206- using ( IProcessProxy process = await this . ExecuteCommandAsync (
207- SysbenchExecutor . PythonCommand ,
208- script + this . sysbenchExecutionArguments ,
209- this . SysbenchPackagePath ,
210- telemetryContext ,
211- cancellationToken ) )
212- {
213- if ( ! cancellationToken . IsCancellationRequested )
214- {
215- await this . LogProcessDetailsAsync ( process , telemetryContext , "Sysbench" , logToFile : true ) ;
216- process . ThrowIfErrored < WorkloadException > ( process . StandardError . ToString ( ) , ErrorReason . WorkloadFailed ) ;
217-
218- this . CaptureMetrics ( process , telemetryContext , cancellationToken ) ;
219- }
220- }
221- }
222-
223- private async Task RunTPCCWorkloadAsync ( EventContext telemetryContext , CancellationToken cancellationToken )
224- {
225- this . sysbenchLoggingArguments = this . BuildSysbenchLoggingArguments ( prepare : false ) ;
226- this . sysbenchExecutionArguments = $ "{ this . sysbenchLoggingArguments } --workload { this . Workload } --hostIpAddress { this . ServerIpAddress } --durationSecs { this . Duration . TotalSeconds } --password { this . SuperUserPassword } ";
182+ this . sysbenchLoggingArguments = this . BuildSysbenchLoggingArguments ( SysbenchMode . Run ) ;
183+ this . sysbenchExecutionArguments = $ "{ this . sysbenchLoggingArguments } --workload { this . Workload } --hostIpAddress { this . ServerIpAddress } --durationSecs { this . Duration . TotalSeconds } --password { this . SuperUserPassword } ";
227184
228- string script = $ "{ this . SysbenchPackagePath } /run-workload.py ";
185+ string script = $ "{ this . SysbenchPackagePath } /run-workload.py ";
229186
230- using ( IProcessProxy process = await this . ExecuteCommandAsync (
231- SysbenchExecutor . PythonCommand ,
232- script + this . sysbenchExecutionArguments ,
233- this . SysbenchPackagePath ,
234- telemetryContext ,
235- cancellationToken ) )
236- {
237- if ( ! cancellationToken . IsCancellationRequested )
238- {
239- await this . LogProcessDetailsAsync ( process , telemetryContext , "Sysbench" , logToFile : true ) ;
240- process . ThrowIfErrored < WorkloadException > ( process . StandardError . ToString ( ) , ErrorReason . WorkloadFailed ) ;
187+ using ( IProcessProxy process = await this . ExecuteCommandAsync (
188+ SysbenchExecutor . PythonCommand ,
189+ script + this . sysbenchExecutionArguments ,
190+ this . SysbenchPackagePath ,
191+ telemetryContext ,
192+ cancellationToken ) )
193+ {
194+ if ( ! cancellationToken . IsCancellationRequested )
195+ {
196+ await this . LogProcessDetailsAsync ( process , telemetryContext , "Sysbench" , logToFile : true ) ;
197+ process . ThrowIfErrored < WorkloadException > ( process . StandardError . ToString ( ) , ErrorReason . WorkloadFailed ) ;
241198
242- this . CaptureMetrics ( process , telemetryContext , cancellationToken ) ;
199+ this . CaptureMetrics ( process , telemetryContext , cancellationToken ) ;
200+ }
201+ }
243202 }
244- }
203+ } ) ;
245204 }
246205 }
247206}
0 commit comments