@@ -433,7 +433,10 @@ let getListOfBugsFromBugBuckets bugBuckets =
433433 let path = bugBuckets ++ " bug_buckets.json"
434434 if IO.File.Exists path then
435435 let bugHashes : RESTlerTypes.Logs.BugHashes = Json.Compact.Strict.deserializeFile path
436- return Some bugHashes
436+ if isNull ( box bugHashes) then
437+ return None
438+ else
439+ return Some bugHashes
437440 else
438441 return Some Map.empty
439442 else
@@ -467,32 +470,28 @@ let pollForBugFound workingDirectory (token: Threading.CancellationToken) (runSt
467470 let restlerExperimentLogs = experiment.FullName ++ " logs"
468471
469472 if IO.Directory.Exists restlerExperimentLogs then
470- try
471- match ! getListOfBugs workingDirectory runStartTime with
472- | None -> ()
473- | Some bugFiles ->
474- let bugsFoundPosted = restlerExperimentLogs ++ " raft-bugsfound.posted.txt"
475- let! postedBugs =
473+ match ! getListOfBugs workingDirectory runStartTime with
474+ | None -> ()
475+ | Some bugFiles ->
476+ let bugsFoundPosted = restlerExperimentLogs ++ " raft-bugsfound.posted.txt"
477+ let! postedBugs =
478+ async {
479+ if IO.File.Exists bugsFoundPosted then
480+ let! bugsPosted = IO.File.ReadAllLinesAsync( bugsFoundPosted) |> Async.AwaitTask
481+ return Set.ofArray bugsPosted
482+ else
483+ return ignoreBugHashes
484+ }
485+ let! updatedBugsPosted =
486+ bugFiles
487+ |> Seq.map ( fun ( KeyValue ( bugHash , bugFile )) ->
476488 async {
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
489+ if not <| postedBugs.Contains bugHash then
490+ do ! onBugFound ( Map.empty.Add( " Experiment" , experiment.Name) .Add( " BugBucket" , bugFile.file_ path) .Add( " BugHash" , bugHash))
491+ return bugHash
482492 }
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
493+ ) |> Async.Sequential
494+ do ! IO.File.WriteAllLinesAsync( bugsFoundPosted, updatedBugsPosted) |> Async.AwaitTask
496495 return ! poll()
497496 }
498497 poll()
0 commit comments