Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit 9afd1d7

Browse files
stishkinstas
andauthored
Fix regression when common file share is used (#63)
Co-authored-by: stas <[email protected]>
1 parent ca4b4d4 commit 9afd1d7

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

src/Agent/RESTlerAgent/RESTlerDriver.fs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -467,30 +467,32 @@ let pollForBugFound workingDirectory (token: Threading.CancellationToken) (runSt
467467
let restlerExperimentLogs = experiment.FullName ++ "logs"
468468

469469
if IO.Directory.Exists restlerExperimentLogs then
470-
match! getListOfBugs workingDirectory runStartTime with
471-
| None -> ()
472-
| Some bugFiles ->
473-
let bugsFoundPosted = restlerExperimentLogs ++ "raft-bugsfound.posted.txt"
474-
let! postedBugs =
475-
async {
476-
if IO.File.Exists bugsFoundPosted then
477-
let! bugsPosted = IO.File.ReadAllLinesAsync(bugsFoundPosted) |> Async.AwaitTask
478-
return Set.ofArray bugsPosted
479-
else
480-
return ignoreBugHashes
481-
}
482-
let! updatedBugsPosted =
483-
bugFiles
484-
|> Seq.map (fun (KeyValue(bugHash, bugFile)) ->
470+
try
471+
match! getListOfBugs workingDirectory runStartTime with
472+
| None -> ()
473+
| Some bugFiles ->
474+
let bugsFoundPosted = restlerExperimentLogs ++ "raft-bugsfound.posted.txt"
475+
let! postedBugs =
485476
async {
486-
if not <| postedBugs.Contains bugHash then
487-
printfn "Posting bug found %s with hash %s" bugFile.file_path bugHash
488-
do! onBugFound (Map.empty.Add("Experiment", experiment.Name).Add("BugBucket", bugFile.file_path).Add("BugHash", bugHash))
489-
return bugHash
477+
if IO.File.Exists bugsFoundPosted then
478+
let! bugsPosted = IO.File.ReadAllLinesAsync(bugsFoundPosted) |> Async.AwaitTask
479+
return Set.ofArray bugsPosted
480+
else
481+
return ignoreBugHashes
490482
}
491-
) |> Async.Sequential
492-
do! IO.File.WriteAllLinesAsync(bugsFoundPosted, updatedBugsPosted) |> Async.AwaitTask
493-
483+
let! updatedBugsPosted =
484+
bugFiles
485+
|> Seq.map (fun (KeyValue(bugHash, bugFile)) ->
486+
async {
487+
if not <| postedBugs.Contains bugHash then
488+
printfn "Posting bug found %s with hash %s" bugFile.file_path bugHash
489+
do! onBugFound (Map.empty.Add("Experiment", experiment.Name).Add("BugBucket", bugFile.file_path).Add("BugHash", bugHash))
490+
return bugHash
491+
}
492+
) |> Async.Sequential
493+
do! IO.File.WriteAllLinesAsync(bugsFoundPosted, updatedBugsPosted) |> Async.AwaitTask
494+
with
495+
| :? System.ArgumentNullException as ex -> printfn "Got excpetion while polling for bug found: %A" ex
494496
return! poll()
495497
}
496498
poll()

src/Orchestrator/OrchestratorLogic/Orchestrator.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ module ContainerInstances =
505505
)
506506
r, isIdling
507507

508+
let getTaskWorkDirectoryPath (containerGroupName : string) (rootFileShare: string option) (workDirectory : string) (taskOutputFolder : string) =
509+
match rootFileShare with
510+
| None -> sprintf "%s/%s" workDirectory taskOutputFolder
511+
| Some _ -> sprintf "%s/%s/%s" workDirectory containerGroupName taskOutputFolder
512+
508513
let getContainerGroupInstanceConfiguration
509514
(containerGroupName: string)
510515
(logger:ILogger)
@@ -539,7 +544,7 @@ module ContainerInstances =
539544
return
540545
{
541546
RunDirectory = Some runDirectory
542-
WorkDirectory = Some(sprintf "%s/%s" workDirectory task.OutputFolder)
547+
WorkDirectory = Some(getTaskWorkDirectoryPath containerGroupName jobCreateRequest.JobDefinition.RootFileShare workDirectory task.OutputFolder)
543548
ContainerName = (sprintf "%d-%s" i task.OutputFolder).ToLowerInvariant()
544549
ToolConfiguration = toolConfig
545550
}
@@ -803,7 +808,7 @@ module ContainerInstances =
803808
RunDirectory = None
804809
WorkDirectory =
805810
match target.OutputFolder with
806-
| Some x -> Some(sprintf "%s/%s" workDirectory x)
811+
| Some x -> Some(getTaskWorkDirectoryPath containerGroupName jobCreateRequest.JobDefinition.RootFileShare workDirectory x)
807812
| None -> None
808813

809814
ToolConfiguration = {

0 commit comments

Comments
 (0)