Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions src/Agent/RESTlerAgent/RESTlerDriver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -467,30 +467,32 @@ let pollForBugFound workingDirectory (token: Threading.CancellationToken) (runSt
let restlerExperimentLogs = experiment.FullName ++ "logs"

if IO.Directory.Exists restlerExperimentLogs then
match! getListOfBugs workingDirectory runStartTime with
| None -> ()
| Some bugFiles ->
let bugsFoundPosted = restlerExperimentLogs ++ "raft-bugsfound.posted.txt"
let! postedBugs =
async {
if IO.File.Exists bugsFoundPosted then
let! bugsPosted = IO.File.ReadAllLinesAsync(bugsFoundPosted) |> Async.AwaitTask
return Set.ofArray bugsPosted
else
return ignoreBugHashes
}
let! updatedBugsPosted =
bugFiles
|> Seq.map (fun (KeyValue(bugHash, bugFile)) ->
try
match! getListOfBugs workingDirectory runStartTime with
| None -> ()
| Some bugFiles ->
let bugsFoundPosted = restlerExperimentLogs ++ "raft-bugsfound.posted.txt"
let! postedBugs =
async {
if not <| postedBugs.Contains bugHash then
printfn "Posting bug found %s with hash %s" bugFile.file_path bugHash
do! onBugFound (Map.empty.Add("Experiment", experiment.Name).Add("BugBucket", bugFile.file_path).Add("BugHash", bugHash))
return bugHash
if IO.File.Exists bugsFoundPosted then
let! bugsPosted = IO.File.ReadAllLinesAsync(bugsFoundPosted) |> Async.AwaitTask
return Set.ofArray bugsPosted
else
return ignoreBugHashes
}
) |> Async.Sequential
do! IO.File.WriteAllLinesAsync(bugsFoundPosted, updatedBugsPosted) |> Async.AwaitTask

let! updatedBugsPosted =
bugFiles
|> Seq.map (fun (KeyValue(bugHash, bugFile)) ->
async {
if not <| postedBugs.Contains bugHash then
printfn "Posting bug found %s with hash %s" bugFile.file_path bugHash
do! onBugFound (Map.empty.Add("Experiment", experiment.Name).Add("BugBucket", bugFile.file_path).Add("BugHash", bugHash))
return bugHash
}
) |> Async.Sequential
do! IO.File.WriteAllLinesAsync(bugsFoundPosted, updatedBugsPosted) |> Async.AwaitTask
with
| :? System.ArgumentNullException as ex -> printfn "Got excpetion while polling for bug found: %A" ex
return! poll()
}
poll()
Expand Down
9 changes: 7 additions & 2 deletions src/Orchestrator/OrchestratorLogic/Orchestrator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,11 @@ module ContainerInstances =
)
r, isIdling

let getTaskWorkDirectoryPath (containerGroupName : string) (rootFileShare: string option) (workDirectory : string) (taskOutputFolder : string) =
match rootFileShare with
| None -> sprintf "%s/%s" workDirectory taskOutputFolder
| Some _ -> sprintf "%s/%s/%s" workDirectory containerGroupName taskOutputFolder

let getContainerGroupInstanceConfiguration
(containerGroupName: string)
(logger:ILogger)
Expand Down Expand Up @@ -539,7 +544,7 @@ module ContainerInstances =
return
{
RunDirectory = Some runDirectory
WorkDirectory = Some(sprintf "%s/%s" workDirectory task.OutputFolder)
WorkDirectory = Some(getTaskWorkDirectoryPath containerGroupName jobCreateRequest.JobDefinition.RootFileShare workDirectory task.OutputFolder)
ContainerName = (sprintf "%d-%s" i task.OutputFolder).ToLowerInvariant()
ToolConfiguration = toolConfig
}
Expand Down Expand Up @@ -803,7 +808,7 @@ module ContainerInstances =
RunDirectory = None
WorkDirectory =
match target.OutputFolder with
| Some x -> Some(sprintf "%s/%s" workDirectory x)
| Some x -> Some(getTaskWorkDirectoryPath containerGroupName jobCreateRequest.JobDefinition.RootFileShare workDirectory x)
| None -> None

ToolConfiguration = {
Expand Down