Skip to content

Commit 1d6e010

Browse files
saibulususaibulusu
andauthored
FIO Job File support (#300)
* Removing dependency from FioExecutor on DiskWorkloadExecutor. * ScriptPath documentation. * PERF-IO-FIO-OLTP.json exposes the capability to execute a command which uses a jobfile. * Attempting to fix formatting errors for ScriptPath documentation. * Using either job file or command line from profile, can create/update a job file at runtime. * Fixing issues with creating/updating job file at runtime. * Simplifying CreateOrUpdateJobFile, the user is expected to provide each parameter within the profile. * Added unit tests for FioExecutor using a jobfile. * Removing architecture from unit test, does not need to be specified. * Removing ioengine & file paths from profile. * Added a test for multiple job file templates. * Including a job file template which does not have ioengine or filename. * Adding more sections to the OLTP profile for different block sizes. * Documentation. * Filtering out wranings from standard output to avoid parsing error. * Regex to replace text from template job files. * Slight documentation fix. * Updating vc version. * Small profile fix in metadata section. * Small profile fix. * Resolving comments. * Resolving comments: Adding seperate template job files, one for disk fill and one for operations. * Resolving comments. * Resolving comments. * Small profile fix. --------- Co-authored-by: saibulusu <[email protected]>
1 parent 8ea4d21 commit 1d6e010

File tree

11 files changed

+1184
-206
lines changed

11 files changed

+1184
-206
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resources:
1616
options: --entrypoint=""
1717

1818
variables:
19-
VcVersion : 1.14.19
19+
VcVersion : 1.14.21
2020
ROOT: $(Build.SourcesDirectory)
2121
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2222
ENABLE_PRS_DELAYSIGN: 1

.pipelines/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pool:
1818
vmImage: windows-latest
1919

2020
variables:
21-
VcVersion : 1.14.20
21+
VcVersion : 1.14.21
2222
ROOT: $(Build.SourcesDirectory)
2323
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2424
ENABLE_PRS_DELAYSIGN: 1

src/VirtualClient/VirtualClient.Actions.UnitTests/FIO/FioExecutorTests.cs

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace VirtualClient.Actions.DiskPerformance
55
{
66
using System;
7+
using System.CodeDom.Compiler;
78
using System.Collections.Generic;
89
using System.Diagnostics;
910
using System.IO;
@@ -27,6 +28,7 @@ public class FioExecutorTests
2728
private IEnumerable<Disk> disks;
2829
private string mockCommandLine;
2930
private string mockResults;
31+
private DependencyPath mockWorkloadPackage;
3032

3133
[OneTimeSetUp]
3234
public void SetupFixture()
@@ -48,14 +50,16 @@ public void SetupTest()
4850
{ nameof(FioExecutor.CommandLine), this.mockCommandLine },
4951
{ nameof(FioExecutor.ProcessModel), WorkloadProcessModel.SingleProcess },
5052
{ nameof(FioExecutor.DeleteTestFilesOnFinish), "true" },
51-
{ nameof(FioExecutor.TestName), "fio_test_1" }
53+
{ nameof(FioExecutor.TestName), "fio_test_1" },
54+
{ nameof(FioExecutor.PackageName), "fio" }
5255
};
5356

5457
this.disks = this.mockFixture.CreateDisks(PlatformID.Unix, true);
5558

5659
this.mockFixture.DiskManager.Setup(mgr => mgr.GetDisksAsync(It.IsAny<CancellationToken>())).ReturnsAsync(() => this.disks);
5760
this.mockFixture.PackageManager.OnGetPackage().ReturnsAsync(new DependencyPath("fio", this.mockFixture.GetPackagePath("fio")));
5861
this.mockFixture.File.OnFileExists().Returns(true);
62+
this.mockFixture.File.Setup(file => file.ReadAllText(It.IsAny<string>())).Returns(string.Empty);
5963
this.mockFixture.ProcessManager.OnCreateProcess = (command, arguments, workingDir) =>
6064
{
6165
return new InMemoryProcess
@@ -71,6 +75,11 @@ public void SetupTest()
7175
StandardOutput = new ConcurrentBuffer(new StringBuilder(this.mockResults))
7276
};
7377
};
78+
79+
string workloadName = "fio";
80+
this.mockWorkloadPackage = new DependencyPath(
81+
workloadName,
82+
this.mockFixture.PlatformSpecifics.GetPackagePath(workloadName));
7483
}
7584

7685
[Test]
@@ -97,6 +106,74 @@ public void FioExecutorAppliesConfigurationParametersCorrectly()
97106
}
98107
}
99108

109+
[Test]
110+
public void FioExecutorThrowsOnNullCommandLineAndJobFiles()
111+
{
112+
this.profileParameters[nameof(TestFioExecutor.CommandLine)] = null;
113+
this.profileParameters[nameof(TestFioExecutor.JobFiles)] = null;
114+
115+
using (TestFioExecutor executor = new TestFioExecutor(this.mockFixture.Dependencies, this.profileParameters))
116+
{
117+
WorkloadException error = Assert.Throws<WorkloadException>(executor.Validate);
118+
119+
Assert.AreEqual(ErrorReason.InvalidProfileDefinition, error.Reason);
120+
}
121+
}
122+
123+
[Test]
124+
public void FioExecutorThrowsIfCommandLineAndJobFilesIncluded()
125+
{
126+
this.profileParameters[nameof(TestFioExecutor.CommandLine)] = "--name=fio_randwrite_{FileSize}_4k_d{QueueDepth}_th{ThreadCount}_direct --size=496GB --numjobs={ThreadCount} --rw=randwrite --bs=4k --iodepth={QueueDepth}";
127+
this.profileParameters[nameof(TestFioExecutor.JobFiles)] = "{ScriptPath:fio}/oltp-c.fio.jobfile";
128+
129+
using (TestFioExecutor executor = new TestFioExecutor(this.mockFixture.Dependencies, this.profileParameters))
130+
{
131+
WorkloadException error = Assert.Throws<WorkloadException>(executor.Validate);
132+
133+
Assert.AreEqual(ErrorReason.InvalidProfileDefinition, error.Reason);
134+
}
135+
}
136+
137+
[Test]
138+
public async Task FioExecutorRunsCommandWithJobFile()
139+
{
140+
this.profileParameters[nameof(TestFioExecutor.CommandLine)] = null;
141+
this.profileParameters[nameof(TestFioExecutor.JobFiles)] = "jobfile1path";
142+
143+
DependencyPath workloadPlatformSpecificPackage =
144+
this.mockFixture.ToPlatformSpecificPath(this.mockWorkloadPackage, this.mockFixture.Platform, this.mockFixture.CpuArchitecture);
145+
146+
using (TestFioExecutor executor = new TestFioExecutor(this.mockFixture.Dependencies, this.profileParameters))
147+
{
148+
await executor.ExecuteAsync(CancellationToken.None);
149+
150+
string updatedJobFilePath = this.mockFixture.PlatformSpecifics.Combine(workloadPlatformSpecificPackage.Path, "jobfile1path");
151+
152+
Assert.AreEqual($"{updatedJobFilePath} --output-format=json", executor.CommandLine);
153+
}
154+
}
155+
156+
[Test]
157+
public async Task FioExecutorRunsCommandWithMultipleJobFiles()
158+
{
159+
this.profileParameters[nameof(TestFioExecutor.CommandLine)] = null;
160+
this.profileParameters[nameof(TestFioExecutor.JobFiles)] = "path/to/jobfile1,path/jobfile2;path/jobfile3";
161+
162+
DependencyPath workloadPlatformSpecificPackage =
163+
this.mockFixture.ToPlatformSpecificPath(this.mockWorkloadPackage, this.mockFixture.Platform, this.mockFixture.CpuArchitecture);
164+
165+
using (TestFioExecutor executor = new TestFioExecutor(this.mockFixture.Dependencies, this.profileParameters))
166+
{
167+
await executor.ExecuteAsync(CancellationToken.None);
168+
169+
string updatedJobFile1Path = this.mockFixture.PlatformSpecifics.Combine(workloadPlatformSpecificPackage.Path, "jobfile1");
170+
string updatedJobFile2Path = this.mockFixture.PlatformSpecifics.Combine(workloadPlatformSpecificPackage.Path, "jobfile2");
171+
string updatedJobFile3Path = this.mockFixture.PlatformSpecifics.Combine(workloadPlatformSpecificPackage.Path, "jobfile3");
172+
173+
Assert.AreEqual($"{updatedJobFile1Path} {updatedJobFile2Path} {updatedJobFile3Path} --output-format=json", executor.CommandLine);
174+
}
175+
}
176+
100177
[Test]
101178
public void FioExecutorAppliesConfigurationParametersCorrectly_DiskFillScenario()
102179
{
@@ -267,6 +344,11 @@ public TestFioExecutor(IServiceCollection dependencies, IDictionary<string, ICon
267344
{
268345
return base.CreateWorkloadProcess(executable, commandArguments, testedInstance, disksToTest);
269346
}
347+
348+
public new void Validate()
349+
{
350+
base.Validate();
351+
}
270352
}
271353
}
272354
}

src/VirtualClient/VirtualClient.Actions/FIO/FioDiscoveryExecutor.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ public List<string> BlockSize
5252
}
5353
}
5454

55+
/// <summary>
56+
/// The size of the test file that should use in workload tests (e.g. 496GB).
57+
/// </summary>
58+
public string FileSize
59+
{
60+
get
61+
{
62+
this.Parameters.TryGetValue(nameof(DiskWorkloadExecutor.FileSize), out IConvertible fileSize);
63+
return fileSize?.ToString();
64+
}
65+
66+
set
67+
{
68+
this.Parameters[nameof(DiskWorkloadExecutor.FileSize)] = value;
69+
}
70+
}
71+
5572
/// <summary>
5673
/// Parameter. True to used direct, non-buffered I/O (default). False to use buffered I/O.
5774
/// </summary>

0 commit comments

Comments
 (0)