@@ -4,42 +4,42 @@ open NUnit.Framework
44open GraphDef
55open GraphPipeline.Batch
66
7+ let buildNode id clusterHash action deps group req =
8+ { Node.Id = id
9+ Node.ProjectId = id
10+ Node.ProjectName = None
11+ Node.ProjectDir = $" /src/project{id}"
12+ Node.Target = " build"
13+ Node.Dependencies = deps
14+ Node.Outputs = Set.empty
15+ Node.ProjectHash = " "
16+ Node.TargetHash = " "
17+ Node.ClusterHash = clusterHash
18+ Node.Operations = []
19+ Node.Artifacts = ArtifactMode.Workspace
20+ Node.Action = action
21+ Node.Build = BuildMode.Auto
22+ Node.Batch = group
23+ Node.Required = req }
24+
25+ let addNode ( node : Node ) nodes = nodes |> Map.add node.Id node
26+
727[<Test>]
828let ``check partition computation`` () =
9- let buildNode id clusterHash action deps =
10- { Node.Id = id
11- Node.ProjectId = id
12- Node.ProjectName = None
13- Node.ProjectDir = $" /src/project{id}"
14- Node.Target = " build"
15- Node.Dependencies = deps
16- Node.Outputs = Set.empty
17- Node.ProjectHash = " "
18- Node.TargetHash = " "
19- Node.ClusterHash = clusterHash
20- Node.Operations = []
21- Node.Artifacts = ArtifactMode.Workspace
22- Node.Action = action
23- Node.Build = BuildMode.Auto
24- Node.Batch = BatchMode.Partition
25- Node.Required = true }
26-
27- let addNode ( node : Node ) nodes = nodes |> Map.add node.Id node
28-
2929 // Bucket hash-A: connected via A1 -> A2 (in-bucket edge)
30- let nodeA1 = buildNode " A1" ( Some " hash-A" ) RunAction.Exec ( Set [ " A2" ; " B1" ])
31- let nodeA2 = buildNode " A2" ( Some " hash-A" ) RunAction.Restore Set.empty
30+ let nodeA1 = buildNode " A1" ( Some " hash-A" ) RunAction.Exec ( Set [ " A2" ; " B1" ]) BatchMode.Partition true
31+ let nodeA2 = buildNode " A2" ( Some " hash-A" ) RunAction.Restore Set.empty BatchMode.Partition true
3232
3333 // Bucket hash-B: connected via B1 -> B2 (in-bucket edge)
34- let nodeB1 = buildNode " B1" ( Some " hash-B" ) RunAction.Exec ( Set [ " B2" ])
35- let nodeB2 = buildNode " B2" ( Some " hash-B" ) RunAction.Exec Set.empty
34+ let nodeB1 = buildNode " B1" ( Some " hash-B" ) RunAction.Exec ( Set [ " B2" ]) BatchMode.Partition true
35+ let nodeB2 = buildNode " B2" ( Some " hash-B" ) RunAction.Exec Set.empty BatchMode.Partition true
3636
3737 // Bucket hash-C: connected but inactive (no Build) => no batch
38- let nodeC1 = buildNode " C1" ( Some " hash-C" ) RunAction.Restore ( Set [ " C2" ])
39- let nodeC2 = buildNode " C2" ( Some " hash-C" ) RunAction.Restore Set.empty
38+ let nodeC1 = buildNode " C1" ( Some " hash-C" ) RunAction.Restore ( Set [ " C2" ]) BatchMode.Partition true
39+ let nodeC2 = buildNode " C2" ( Some " hash-C" ) RunAction.Restore Set.empty BatchMode.Partition true
4040
4141 // Not batchable
42- let nodeD1 = buildNode " D1" None RunAction.Exec Set.empty
42+ let nodeD1 = buildNode " D1" None RunAction.Exec Set.empty BatchMode.Partition true
4343
4444 let nodes =
4545 Map.empty
@@ -78,38 +78,18 @@ let ``check partition computation``() =
7878
7979[<Test>]
8080let ``check partition / all computation`` () =
81- let buildNode id clusterHash action deps group =
82- { Node.Id = id
83- Node.ProjectId = id
84- Node.ProjectName = None
85- Node.ProjectDir = $" /src/project{id}"
86- Node.Target = " build"
87- Node.Dependencies = deps
88- Node.Outputs = Set.empty
89- Node.ProjectHash = " "
90- Node.TargetHash = " "
91- Node.ClusterHash = clusterHash
92- Node.Operations = []
93- Node.Artifacts = ArtifactMode.Workspace
94- Node.Action = action
95- Node.Build = BuildMode.Auto
96- Node.Batch = group
97- Node.Required = true }
98-
99- let addNode ( node : Node ) nodes = nodes |> Map.add node.Id node
100-
10181 // Bucket hash-A: connected via A1 -> A2 (in-bucket edge)
102- let nodeA1 = buildNode " A1" ( Some " hash-A" ) RunAction.Restore ( Set [ " A2" ; " B1" ]) BatchMode.Partition
103- let nodeA2 = buildNode " A2" ( Some " hash-A" ) RunAction.Restore Set.empty BatchMode.Partition
82+ let nodeA1 = buildNode " A1" ( Some " hash-A" ) RunAction.Restore ( Set [ " A2" ; " B1" ]) BatchMode.Partition true
83+ let nodeA2 = buildNode " A2" ( Some " hash-A" ) RunAction.Restore Set.empty BatchMode.Partition true
10484
10585 // Bucket hash-B: connected via B1 -> B2 (in-bucket edge)
106- let nodeB1 = buildNode " B1" ( Some " hash-B" ) RunAction.Exec ( Set [ " B2" ]) BatchMode.All
107- let nodeB2 = buildNode " B2" ( Some " hash-B" ) RunAction.Exec Set.empty BatchMode.All
108- let nodeC1 = buildNode " C1" ( Some " hash-B" ) RunAction.Exec ( Set [ " C2" ]) BatchMode.All
109- let nodeC2 = buildNode " C2" ( Some " hash-B" ) RunAction.Exec Set.empty BatchMode.All
86+ let nodeB1 = buildNode " B1" ( Some " hash-B" ) RunAction.Exec ( Set [ " B2" ]) BatchMode.Single true
87+ let nodeB2 = buildNode " B2" ( Some " hash-B" ) RunAction.Exec Set.empty BatchMode.Single true
88+ let nodeC1 = buildNode " C1" ( Some " hash-B" ) RunAction.Exec ( Set [ " C2" ]) BatchMode.Single true
89+ let nodeC2 = buildNode " C2" ( Some " hash-B" ) RunAction.Exec Set.empty BatchMode.Single true
11090
11191 // Not batchable
112- let nodeD1 = buildNode " D1" None RunAction.Exec Set.empty BatchMode.Partition
92+ let nodeD1 = buildNode " D1" None RunAction.Exec Set.empty BatchMode.Partition true
11393
11494 let nodes =
11595 Map.empty
0 commit comments