This commit is contained in:
Charles Torre 2021-02-24 16:59:26 -08:00
Родитель e1144e1d04
Коммит 75c5fd3ef9
2 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -51,7 +51,7 @@ namespace FHTest
// Set this to the full path to your Rules directory in the FabricHealer project's PackageRoot\Config directory.
// e.g., if developing on Windows, then something like @"C:\Users\[me]\source\repos\service-fabric-healer\FabricHealer\PackageRoot\Config\Rules\";
private const string FHRulesDirectory = @"C:\Users\ctorre\source\repos\microsoft\service-fabric-healer\FabricHealer\PackageRoot\Config\Rules\";
private const string FHRulesDirectory = @"";
public FHUnitTests()
{

Просмотреть файл

@ -1,4 +1,4 @@
## These rules demonstrates a workflow that employs multiple external predicates to get to a solution for a single unhealthy replica scenario:
## These rules demonstrates a workflow that employs multiple internal and external predicates to get to a solution for a single unhealthy replica scenario:
## [SourceId] ='System.RAP' reported Warning/Error for property...
## [Property] = 'IStatefulServiceReplica.ChangeRole(N)Duration'.
## [Description] = The api IStatefulServiceReplica.ChangeRole(N) on node [NodeName] is stuck.
@ -7,17 +7,23 @@
## First, check if we are inside run interval. If so, then cut (!), which effectively means stop processing rules (no backtracking to subsequent rules in the file).
Mitigate() :- CheckInsideRunInterval(RunInterval=00:15:00), !.
## Set ?repairCount (all rules have the same TimeWindow).
Mitigate() :- GetRepairHistory(?repairCount, TimeWindow=01:00:00).
## Set ?repairCount for use by any rule in this file (NOTE: all rules have the same TimeWindow) using an internal predicate, _mitigate(?count), where ?repairCount is unified with ?count when _mitigate(?count) is called.
Mitigate() :- GetRepairHistory(?repairCount, TimeWindow=01:00:00), _mitigate(?repairCount).
## Let's say you wanted to only repair specific Apps or Paritions where related repair TimeWindow values are *not* the same, unlike the above "global" count variable rule.
## You could do something like this, which would mean the _mitigate internal predicate would only run if the supplied argument values are matched:
## Mitigate(AppName="fabric:/foo") :- GetRepairHistory(?repairCount, TimeWindow=01:00:00), _mitigate(?repairCount).
## Mitigate(AppName="fabric:/bar") :- GetRepairHistory(?repairCount, TimeWindow=02:00:00), _mitigate(?repairCount).
## Mitigate(ParititionId="34fb55e9-3d36-451c-8744-5518716acbc1") :- GetRepairHistory(?repairCount, TimeWindow=03:00:00), _mitigate(?repairCount).
## The external predicates here (RestartReplica, RestartCodePackage, RestartFabricNode) implement a BooleanPredicateResolver dervied Resolver type (see /Repair/Guan folder for source code).
## This means that these predicates either succeed (pass true back) or fail (pass false back) as the result of their execution.
## Try this.
Mitigate() :- ?repairCount < 4, RestartReplica().
_mitigate(?count) :- ?count < 4, RestartReplica().
## Else, try this.
Mitigate() :- ?repairCount < 4, RestartCodePackage().
_mitigate(?count) :- ?count < 4, RestartCodePackage().
## Else, try this.
Mitigate() :- ?repairCount < 2, RestartFabricNode().
_mitigate(?count) :- ?count < 2, RestartFabricNode().