示例#1
0
 def test_computation_sandwich(self):
     """
     Tests that an internal data drop surrounded by computing drops is handled correctly.
     """
     lgt = _init_graph("topoGraphs/computationSandwich.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     lg_build_blockdag(lgt)
     parenthashes = list(
         lgt["nodeDataArray"][2]["reprodata"]["lg_parenthashes"].values())
     # Not going to get anything out of this, since reproduce only cares about terminal data.
     self.assertEqual(0, len(parenthashes))
示例#2
0
 def test_data_funnel(self):
     """
     Tests that two data sources are collected in a single downstream data drop
     """
     lgt = _init_graph("topoGraphs/dataFunnel.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     lg_build_blockdag(lgt)
     sourcehash = lgt["nodeDataArray"][1]["reprodata"]["lg_blockhash"]
     parenthashes = list(
         lgt["nodeDataArray"][3]["reprodata"]["lg_parenthashes"].values())
     self.assertTrue(sourcehash == parenthashes[0]
                     and len(parenthashes) == 1)
示例#3
0
 def test_computation_sandwich(self):
     """
     Tests that an internal data drop surrounded by computing drops is handled correctly.
     """
     lgt = _init_graph("topoGraphs/computationSandwich.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     lg_build_blockdag(lgt)
     sourcehash = lgt["nodeDataArray"][1]["reprodata"]["lg_blockhash"]
     parenthashes = list(
         lgt["nodeDataArray"][2]["reprodata"]["lg_parenthashes"].values())
     self.assertTrue(sourcehash == parenthashes[0]
                     and len(parenthashes) == 1)
示例#4
0
 def test_data_sandwich(self):
     """
     Tests two data drops with an interim computing drop
     :return:
     """
     lgt = _init_graph("topoGraphs/dataSandwich.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     lg_build_blockdag(lgt)
     sourcehash = lgt["nodeDataArray"][0]["reprodata"]["lg_blockhash"]
     parenthashes = list(
         lgt["nodeDataArray"][2]["reprodata"]["lg_parenthashes"].values())
     self.assertTrue(sourcehash == parenthashes[0]
                     and len(parenthashes) == 1)
示例#5
0
 def test_data_fan(self):
     """
     Tests that a single data source scatters its signature to downstream data drops.
     """
     lgt = _init_graph("topoGraphs/dataFan.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     lg_build_blockdag(lgt)
     sourcehash = lgt["nodeDataArray"][0]["reprodata"]["lg_blockhash"]
     parenthash1 = list(
         lgt["nodeDataArray"][2]["reprodata"]["lg_parenthashes"].values())
     parenthash2 = list(
         lgt["nodeDataArray"][3]["reprodata"]["lg_parenthashes"].values())
     self.assertTrue(parenthash1 == parenthash2
                     and parenthash1[0] == sourcehash)
示例#6
0
 def test_lg_scatter_rerun(self):
     """
     Tests how rerunning treats such a graph.
     Expected behaviour should be the same as any other type of graph - they are all logical
     components
     """
     lgt = _init_graph(
         "test/reproducibility/reproGraphs/simpleScatter.graph")
     init_lgt_repro_data(lgt, rmode=ReproducibilityFlags.RERUN.value)
     init_lg_repro_data(lgt)
     visited = lg_build_blockdag(lgt)[1]
     scatter_drop = lgt["nodeDataArray"][1]
     app_drop = lgt["nodeDataArray"][2]
     scatter_inter_drop = lgt["nodeDataArray"][3]
     # Checks that the input app drop is the parent of the main application
     self.assertEqual(
         list(app_drop["reprodata"]["lg_parenthashes"].values())[0],
         scatter_inter_drop["reprodata"]["lg_blockhash"],
     )
     # Checks that the scatter drop is the parent of the input drop
     self.assertEqual(
         list(scatter_inter_drop["reprodata"]["lg_parenthashes"].values())
         [0],
         scatter_drop["reprodata"]["lg_blockhash"],
     )
     self.assertEqual(visited, [-1, -2, -5, -3, -6, -7, -9])
示例#7
0
 def test_computation_sandwich(self):
     """
     Tests that an internal data drop surrounded by computing drops is handled correctly.
     """
     lgt = _init_graph("topoGraphs/computationSandwich.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     for rmode in ALL_RMODES:
         lg_build_blockdag(lgt, rmode)
         sourcehash = lgt["nodeDataArray"][1]["reprodata"][
             rmode.name]["lg_blockhash"]
         parenthashes = list(lgt["nodeDataArray"][2]["reprodata"][
             rmode.name]["lg_parenthashes"].values())
         if rmode != ReproducibilityFlags.REPRODUCE:
             self.assertTrue(sourcehash == parenthashes[0]
                             and len(parenthashes) == 1)
         else:
             self.assertTrue(len(parenthashes) == 0)
示例#8
0
 def test_data_funnel(self):
     """
     Tests that two data sources are collected in a single downstream data drop
     """
     lgt = _init_graph("topoGraphs/dataFunnel.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     for rmode in ALL_RMODES:
         lg_build_blockdag(lgt, rmode)
         sourcehash = lgt["nodeDataArray"][1]["reprodata"][
             rmode.name]["lg_blockhash"]
         parenthashes = list(lgt["nodeDataArray"][3]["reprodata"][
             rmode.name]["lg_parenthashes"].values())
         if rmode != ReproducibilityFlags.REPRODUCE:
             self.assertTrue(sourcehash == parenthashes[0]
                             and len(parenthashes) == 1)
         else:
             self.assertTrue(len(parenthashes) == 2)
示例#9
0
 def test_lg_blockdag_empty(self):
     """
     Tests an empty graph. Should fail gracefully.
     """
     lgt = self.init_graph("topoGraphs/testEmpty.graph")
     init_lgt_repro_data(lgt, "1")
     init_lg_repro_data(lgt)
     leaves, visited = lg_build_blockdag(lgt)
     self.assertTrue(visited == [])
示例#10
0
 def test_data_fan(self):
     """
     Tests that a single data source scatters its signature to downstream data drops.
     """
     lgt = _init_graph("topoGraphs/dataFan.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     for rmode in ALL_RMODES:
         lg_build_blockdag(lgt, rmode)
         sourcehash = lgt["nodeDataArray"][0]["reprodata"][
             rmode.name]["lg_blockhash"]
         parenthash1 = list(lgt["nodeDataArray"][2]["reprodata"][rmode.name]
                            ["lg_parenthashes"].values())
         parenthash2 = list(lgt["nodeDataArray"][3]["reprodata"][rmode.name]
                            ["lg_parenthashes"].values())
         self.assertTrue(parenthash1 == parenthash2)
         if rmode != ReproducibilityFlags.REPRODUCE:
             self.assertTrue(parenthash1[0] == sourcehash)
示例#11
0
 def test_lg_blockdag_single(self):
     """
     Tests a single drop
     A
     """
     lgt = self.init_graph("topoGraphs/testSingle.graph")
     init_lgt_repro_data(lgt, "1")
     init_lg_repro_data(lgt)
     leaves, visited = lg_build_blockdag(lgt)
     self.assertTrue(visited == [-1])
示例#12
0
 def test_data_sandwich(self):
     """
     Tests two data drops with an interim computing drop
     :return:
     """
     lgt = _init_graph("topoGraphs/dataSandwich.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     for rmode in ALL_RMODES:
         lg_build_blockdag(lgt, rmode)
         sourcehash = lgt["nodeDataArray"][0]["reprodata"][
             rmode.name]["lg_blockhash"]
         parenthashes = list(lgt["nodeDataArray"][2]["reprodata"][
             rmode.name]["lg_parenthashes"].values())
         self.assertTrue(len(parenthashes) == 1)
         if rmode != ReproducibilityFlags.REPRODUCE:
             self.assertTrue(sourcehash == parenthashes[0])
         else:
             self.assertTrue(sourcehash != parenthashes[0])
示例#13
0
 def test_single(self):
     """
     Tests a single drop
     A
     """
     lgt = _init_graph("topoGraphs/testSingle.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     leaves = lg_build_blockdag(lgt)[0]
     self.assertTrue(len(leaves) == 1)
示例#14
0
 def test_lg_blockdag_twolines(self):
     """
     A graph with two starts and two ends
     A --> B
     C --> D
     """
     lgt = self.init_graph("topoGraphs/testTwoLines.graph")
     init_lgt_repro_data(lgt, "1")
     init_lg_repro_data(lgt)
     leaves, visited = lg_build_blockdag(lgt)
     self.assertTrue(visited == [-2, -3, -1, -4])
示例#15
0
 def test_twolines(self):
     """
     A graph with two starts and two ends
     A --> B
     C --> D
     """
     lgt = _init_graph("topoGraphs/testTwoLines.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     leaves = lg_build_blockdag(lgt)[0]
     self.assertTrue(leaves[0] == leaves[1])
示例#16
0
 def test_lg_blockdag_twoend(self):
     """
     A graph with two ends
       --> B
     A
       --> C
     """
     lgt = self.init_graph("topoGraphs/testTwoEnd.graph")
     init_lgt_repro_data(lgt, "1")
     init_lg_repro_data(lgt)
     leaves, visited = lg_build_blockdag(lgt)
     self.assertTrue(visited == [-1, -3, -2])
示例#17
0
 def test_lg_blockdag_twostart(self):
     """
     A graph with two starts
     A -->
          C
     B -->
     """
     lgt = self.init_graph("topoGraphs/testTwoStart.graph")
     init_lgt_repro_data(lgt, "1")
     init_lg_repro_data(lgt)
     leaves, visited = lg_build_blockdag(lgt)
     self.assertTrue(visited == [-3, -1, -2])
示例#18
0
 def test_twoend(self):
     """
     A graph with two ends
       --> B
     A
       --> C
     """
     lgt = _init_graph("topoGraphs/testTwoEnd.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     leaves = lg_build_blockdag(lgt)[0]
     self.assertFalse(leaves[0] == leaves[1])
示例#19
0
 def test_single(self):
     """
     Tests a single drop
     A
     """
     # f = pkg_resources.resource_stream("test.reproducibility","topoGraphs/testSingle.graph")
     # lgt = json.load(f)
     lgt = _init_graph("topoGraphs/testSingle.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     leaves = lg_build_blockdag(lgt)[0]
     self.assertTrue(len(leaves) == 1)
示例#20
0
 def test_twostart(self):
     """
     A graph with two starts
     A -->
          C
     B -->
     """
     lgt = _init_graph("topoGraphs/testTwoStart.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     leaves = lg_build_blockdag(lgt)[0]
     parenthashes = list(
         lgt["nodeDataArray"][1]["reprodata"]["lg_parenthashes"].values())
     self.assertTrue(
         len(leaves) == 1 and len(parenthashes) == 2
         and parenthashes[0] == parenthashes[1])
示例#21
0
 def test_twostart(self):
     """
     A graph with two starts
     A -->
          C
     B -->
     """
     lgt = _init_graph("topoGraphs/testTwoStart.graph")
     init_lgt_repro_data(lgt, rmode=str(self.rmode.value))
     init_lg_repro_data(lgt)
     for rmode in ALL_RMODES:
         leaves = lg_build_blockdag(lgt, rmode)[0]
         parenthashes = list(lgt["nodeDataArray"][1]["reprodata"][
             rmode.name]["lg_parenthashes"].values())
         self.assertTrue(len(leaves) == 1)
         if rmode != ReproducibilityFlags.REPRODUCE:
             self.assertTrue(len(parenthashes) == 2)
             self.assertTrue(parenthashes[0] == parenthashes[1])
         else:
             self.assertTrue(len(parenthashes) == 0)