Skip to content

Commit 23341fc

Browse files
Adding MLPerfExecutor creating directory instead of mkdir (#324)
* Adding MLPerfExecutor creating directory * Bumping up version * adding unit test fix --------- Co-authored-by: Deepanshu Vaid <[email protected]>
1 parent 87f05d0 commit 23341fc

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
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.31
19+
VcVersion : 1.14.32
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.31
21+
VcVersion : 1.14.32
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/MLPerf/MLPerfExecutorTests.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ public async Task MLPerfExecutorInitializesWorkloadAsExpected()
151151
List<string> expectedCommands = new List<string>
152152
{
153153
"sudo usermod -aG docker anyuser",
154-
"sudo bash -c \"export MLPERF_SCRATCH_PATH=/dev/sdd1/scratch" +
155-
" && mkdir $MLPERF_SCRATCH_PATH/data $MLPERF_SCRATCH_PATH/models $MLPERF_SCRATCH_PATH/preprocessed_data\"",
156154
"sudo -u anyuser bash -c \"make prebuild MLPERF_SCRATCH_PATH=/dev/sdd1/scratch\"",
157155
"sudo docker ps",
158156
"sudo docker exec -u anyuser mlperf-inference-anyuser-x86_64 sudo bash -c " +
@@ -196,6 +194,18 @@ public async Task MLPerfExecutorInitializesWorkloadAsExpected()
196194
})
197195
.ReturnsAsync(makeFileString);
198196

197+
IEnumerable<string> expectedDirectories = new List<string>
198+
{
199+
"/dev/sdd1/scratch/data",
200+
"/dev/sdd1/scratch/models",
201+
"/dev/sdd1/scratch/preprocessed_data"
202+
};
203+
204+
this.mockFixture.Directory.Setup(d => d.CreateDirectory(It.IsAny<string>())).Callback<string>((directory) =>
205+
{
206+
Assert.IsTrue(expectedDirectories.Select(ed => directory.Contains(ed)).Any());
207+
});
208+
199209
List<string> commandsExecuted = new List<string>();
200210
this.mockFixture.ProcessManager.OnCreateProcess = (file, arguments, workingDirectory) =>
201211
{
@@ -246,6 +256,17 @@ public async Task MLPerfExecutorExecutesAsExpected()
246256
.ReturnsAsync(makeFileString);
247257

248258
IEnumerable<string> expectedCommands = this.GetExpectedCommands();
259+
IEnumerable<string> expectedDirectories = new List<string>
260+
{
261+
"/dev/sdd1/scratch/data",
262+
"/dev/sdd1/scratch/models",
263+
"/dev/sdd1/scratch/preprocessed_data"
264+
};
265+
266+
this.mockFixture.Directory.Setup(d => d.CreateDirectory(It.IsAny<string>())).Callback<string>((directory) =>
267+
{
268+
Assert.IsTrue(expectedDirectories.Select(ed => directory.Contains(ed)).Any());
269+
});
249270

250271
List<string> commandsExecuted = new List<string>();
251272

@@ -298,8 +319,6 @@ private IEnumerable<string> GetExpectedCommands()
298319
commands = new List<string>
299320
{
300321
"sudo usermod -aG docker anyuser",
301-
"sudo bash -c \"export MLPERF_SCRATCH_PATH=/dev/sdd1/scratch" +
302-
" && mkdir $MLPERF_SCRATCH_PATH/data $MLPERF_SCRATCH_PATH/models $MLPERF_SCRATCH_PATH/preprocessed_data\"",
303322
"sudo -u anyuser bash -c \"make prebuild MLPERF_SCRATCH_PATH=/dev/sdd1/scratch\"",
304323
"sudo docker ps",
305324
"sudo docker exec -u anyuser mlperf-inference-anyuser-x86_64 sudo bash -c " +

src/VirtualClient/VirtualClient.Actions/MLPerf/MLPerfExecutor.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,9 @@ protected async Task SetupEnvironmentAsync(CancellationToken cancellationToken)
332332
{
333333
string dockerExecCommand = $"docker exec -u {this.Username} {this.GetContainerName()}";
334334

335-
await this.ExecuteCommandAsync(
336-
"bash",
337-
$"-c \"{this.ExportScratchSpace} && mkdir $MLPERF_SCRATCH_PATH/data $MLPERF_SCRATCH_PATH/models $MLPERF_SCRATCH_PATH/preprocessed_data\"",
338-
this.NvidiaDirectory,
339-
cancellationToken);
335+
this.fileSystem.Directory.CreateDirectory(this.PlatformSpecifics.Combine(this.mlperfScratchSpace, "data"));
336+
this.fileSystem.Directory.CreateDirectory(this.PlatformSpecifics.Combine(this.mlperfScratchSpace, "models"));
337+
this.fileSystem.Directory.CreateDirectory(this.PlatformSpecifics.Combine(this.mlperfScratchSpace, "preprocessed_data"));
340338

341339
await this.ExecuteCommandAsync(
342340
"sudo",

0 commit comments

Comments
 (0)