@@ -547,10 +547,17 @@ let main argv =
547
547
do ! Raft.RESTlerDriver.compile restlerPath workDirectory compilerConfig
548
548
}
549
549
550
- let report state ( summary : Raft.JobEvents.RunSummary option ) =
550
+ let report state ( experiment : string option , summary : Raft.JobEvents.RunSummary option ) =
551
551
async {
552
552
printfn " Reporting summary [%A ]: %A " state summary
553
553
let! bugsList = Raft.RESTlerDriver.getListOfBugs workDirectory globalRunStartTime
554
+ let bugsListLen = match bugsList with None -> 0 | Some xs -> Seq.length xs
555
+
556
+ let details =
557
+ match experiment with
558
+ | Some e -> Map.empty.Add( " Experiment" , e)
559
+ | None -> Map.empty
560
+
554
561
do ! jobEventSender.SendRaftJobEvent jobId
555
562
({
556
563
AgentName = agentName
@@ -561,7 +568,7 @@ let main argv =
561
568
562
569
Metrics = summary
563
570
UtcEventTime = System.DateTime.UtcNow
564
- Details = Some <| Map.empty. Add( " numberOfBugsFound" , sprintf " %d " ( Seq.length bugsList ))
571
+ Details = Some( details. Add( " numberOfBugsFound" , sprintf " %d " bugsListLen ))
565
572
} : Raft.JobEvents.JobStatus)
566
573
}
567
574
@@ -617,7 +624,13 @@ let main argv =
617
624
let targetIp , targetPort = getIpAndPort jobConfiguration.TargetEndpointConfiguration
618
625
let engineParameters = createRESTlerEngineParameters ( targetIp, targetPort) grammarPy dictJson task checkerOptions jobConfiguration
619
626
printfn " Starting RESTler test task"
620
- do ! Raft.RESTlerDriver.test testType restlerPath workDirectory engineParameters onBugFound ( report Raft.JobEvents.JobState.Running) ( globalRunStartTime, resultAnalyzerReportInterval)
627
+
628
+ let ignoreBugHashes =
629
+ match jobConfiguration.IgnoreBugHashes with
630
+ | None -> Set.empty
631
+ | Some hs -> Set.ofArray hs
632
+
633
+ do ! Raft.RESTlerDriver.test testType restlerPath workDirectory engineParameters ignoreBugHashes onBugFound ( report Raft.JobEvents.JobState.Running) ( globalRunStartTime, resultAnalyzerReportInterval)
621
634
}
622
635
623
636
let fuzz ( fuzzType : string ) checkerOptions ( jobConfiguration : RunConfiguration ) =
@@ -626,7 +639,13 @@ let main argv =
626
639
let targetIp , targetPort = getIpAndPort jobConfiguration.TargetEndpointConfiguration
627
640
let engineParameters = createRESTlerEngineParameters ( targetIp, targetPort) grammarPy dictJson task checkerOptions jobConfiguration
628
641
printfn " Starting RESTler fuzz task"
629
- do ! Raft.RESTlerDriver.fuzz fuzzType restlerPath workDirectory engineParameters onBugFound ( report Raft.JobEvents.JobState.Running) ( globalRunStartTime, resultAnalyzerReportInterval)
642
+
643
+ let ignoreBugHashes =
644
+ match jobConfiguration.IgnoreBugHashes with
645
+ | None -> Set.empty
646
+ | Some hs -> Set.ofArray hs
647
+
648
+ do ! Raft.RESTlerDriver.fuzz fuzzType restlerPath workDirectory engineParameters ignoreBugHashes onBugFound ( report Raft.JobEvents.JobState.Running) ( globalRunStartTime, resultAnalyzerReportInterval)
630
649
}
631
650
632
651
let replay replayLogFile ( jobConfiguration : RunConfiguration ) =
@@ -658,7 +677,7 @@ let main argv =
658
677
// Start RESTler process with following flags
659
678
// compile, test, fuzz
660
679
// --telemetryRootDirPath
661
- let! state , details , exitCode , summary =
680
+ let! state , details , exitCode , ( experiment , summary ) =
662
681
async {
663
682
try
664
683
match restlerPayload.Task with
@@ -697,7 +716,7 @@ let main argv =
697
716
| None -> return failwithf " Job-run configuration is not set for Test task for job payload: %A " restlerPayload
698
717
| Some jobConfiguration ->
699
718
copyDir jobConfiguration.InputFolderPath workDirectory ( set [ taskConfigurationPath])
700
- do ! report Raft.JobEvents.Running None
719
+ do ! report Raft.JobEvents.Running ( None, None )
701
720
do ! test " directed-smoke-test" [] jobConfiguration
702
721
let! summary = Raft.RESTlerDriver.processRunSummary workDirectory globalRunStartTime
703
722
return Raft.JobEvents.Completed, None, 0 , summary
@@ -708,7 +727,7 @@ let main argv =
708
727
| None -> return failwithf " Job-run configuration is not set for Test task for job payload: %A " restlerPayload
709
728
| Some jobConfiguration ->
710
729
copyDir jobConfiguration.InputFolderPath workDirectory ( set [ taskConfigurationPath])
711
- do ! report Raft.JobEvents.Running None
730
+ do ! report Raft.JobEvents.Running ( None, None )
712
731
let fuzzLeanCheckers =
713
732
[
714
733
( " --enable_checkers" , " *" )
@@ -724,7 +743,7 @@ let main argv =
724
743
| None -> return failwithf " Job-run configuration is not set for Compile task for job payload: %A " restlerPayload
725
744
| Some jobConfiguration ->
726
745
copyDir jobConfiguration.InputFolderPath workDirectory ( set [ taskConfigurationPath])
727
- do ! report Raft.JobEvents.Running None
746
+ do ! report Raft.JobEvents.Running ( None, None )
728
747
let allCheckers = [ " --enable_checkers" , " *" ]
729
748
do ! fuzz " bfs" allCheckers jobConfiguration
730
749
let! summary = Raft.RESTlerDriver.processRunSummary workDirectory globalRunStartTime
@@ -736,7 +755,7 @@ let main argv =
736
755
| None -> return failwithf " Job-run configuration is not set for Test task for job payload: %A " restlerPayload
737
756
| Some jobConfiguration ->
738
757
copyDir jobConfiguration.InputFolderPath workDirectory ( set [ taskConfigurationPath])
739
- do ! report Raft.JobEvents.Running None
758
+ do ! report Raft.JobEvents.Running ( None, None )
740
759
let allCheckers = [ " --enable_checkers" , " *" ]
741
760
do ! fuzz " bfs-cheap" allCheckers jobConfiguration
742
761
let! summary = Raft.RESTlerDriver.processRunSummary workDirectory globalRunStartTime
@@ -748,7 +767,7 @@ let main argv =
748
767
| None -> return failwithf " Job-run configuration is not set for Fuzz task for job payload: %A " restlerPayload
749
768
| Some jobConfiguration ->
750
769
copyDir jobConfiguration.InputFolderPath workDirectory ( set [ taskConfigurationPath])
751
- do ! report Raft.JobEvents.Running None
770
+ do ! report Raft.JobEvents.Running ( None, None )
752
771
let allCheckers = [ " --enable_checkers" , " *" ]
753
772
do ! fuzz " random-walk" allCheckers jobConfiguration
754
773
let! summary = Raft.RESTlerDriver.processRunSummary workDirectory globalRunStartTime
@@ -759,23 +778,59 @@ let main argv =
759
778
| None -> return failwithf " Job-run configuration is not set Replay task for job payload: %A " restlerPayload
760
779
| Some replayRunConfiguration ->
761
780
let replaySourcePath = replayRunConfiguration.InputFolderPath
762
- do ! report Raft.JobEvents.Running None
781
+ do ! report Raft.JobEvents.Running ( None, None )
763
782
764
783
let replayAndReport ( bugs : IO.FileInfo seq ) =
765
784
async {
785
+ let! existingBugBuckets = Raft.RESTlerDriver.getListOfBugsFromBugBuckets replayRunConfiguration.InputFolderPath
786
+
787
+ let remapBugHashes ( bugHashes : Raft.RESTlerTypes.Logs.BugHashes ) =
788
+ bugHashes
789
+ |> Seq.map( fun ( KeyValue ( k , v )) -> v.file_ path, k)
790
+ |> Map.ofSeq
791
+
792
+ let bugs , fileNameToBugHashMap =
793
+ match replayRunConfiguration.IgnoreBugHashes, existingBugBuckets with
794
+ | None, None | Some _, None -> bugs, Map.empty
795
+ | None, Some existingBugs ->
796
+ bugs, ( remapBugHashes existingBugs)
797
+
798
+ | Some ignoreHashes, Some existingBugs ->
799
+ let filesToIgnore =
800
+ ignoreHashes
801
+ |> Array.map( fun h ->
802
+ match Map.tryFind h existingBugs with
803
+ | None -> None
804
+ | Some b -> Some b.file_ path
805
+ )
806
+ |> Array.filter Option.isSome
807
+ |> Array.map Option.get
808
+ |> Set.ofArray
809
+
810
+ let filteredBugs =
811
+ bugs
812
+ |> Seq.filter ( fun b ->
813
+ not ( filesToIgnore.Contains b.Name)
814
+ )
815
+ filteredBugs, ( remapBugHashes existingBugs)
816
+
766
817
let replaySummaryDetails = ResizeArray< string * string>()
767
818
768
819
for bug in bugs do
769
820
printfn " Running replay on %s " bug.FullName
770
- let! replaySummary = replay bug.FullName replayRunConfiguration
821
+ let! ( experiment , replaySummary ) = replay bug.FullName replayRunConfiguration
771
822
let summary =
772
823
match replaySummary with
773
824
| None ->
774
825
sprintf " %s : No results" bug.Name
775
826
| Some s ->
776
- sprintf " %s : %A " bug.Name ( s.ResponseCodeCounts |> Map.toList)
827
+ sprintf " %s / %s : %A " ( Option.defaultValue " ExperimentNotSet " experiment ) bug.Name ( s.ResponseCodeCounts |> Map.toList)
777
828
778
- replaySummaryDetails.Add( bug.Name, summary)
829
+ let bugKey =
830
+ match Map.tryFind bug.Name fileNameToBugHashMap with
831
+ | None -> bug.Name
832
+ | Some h -> h
833
+ replaySummaryDetails.Add( bugKey, summary)
779
834
do ! jobEventSender.SendRaftJobEvent jobId
780
835
({
781
836
AgentName = agentName
@@ -823,7 +878,7 @@ let main argv =
823
878
return Some details
824
879
| None -> return ! replayAll()
825
880
}
826
- return Raft.JobEvents.Completed, ( details |> Option.map Map.ofSeq), 0 , None
881
+ return Raft.JobEvents.Completed, ( details |> Option.map Map.ofSeq), 0 , ( None, None )
827
882
with
828
883
| ex ->
829
884
printfn " %A " ex
@@ -832,17 +887,24 @@ let main argv =
832
887
}
833
888
834
889
let! bugsList = Raft.RESTlerDriver.getListOfBugs workDirectory globalRunStartTime
890
+ let bugsListLen = match bugsList with None -> 0 | Some xs -> Seq.length xs
835
891
836
892
let testingSummary = Raft.RESTlerDriver.loadTestRunSummary workDirectory globalRunStartTime
837
893
894
+ let details =
895
+ let d = Option.defaultValue Map.empty details
896
+ match experiment with
897
+ | Some e -> Some ( d.Add( " Experiment" , e))
898
+ | None -> Some d
899
+
838
900
let details =
839
901
match testingSummary with
840
902
| None -> details
841
903
| Some status ->
842
904
let d = Option.defaultValue Map.empty details
843
905
Some( d
844
906
.Add( " finalSpecCoverage" , status.final_ spec_ coverage)
845
- .Add( " numberOfBugsFound" , sprintf " %d " ( Seq.length bugsList ) )
907
+ .Add( " numberOfBugsFound" , sprintf " %d " bugsListLen )
846
908
//.Add("renderedRequests", status.rendered_requests)
847
909
//.Add("renderedRequestsValidStatus", status.rendered_requests_valid_status)
848
910
//.Add("numFullyValid", sprintf "%d" status.num_fully_valid)
0 commit comments