示例#1
0
 def test_is_status_consistent_4(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.set_status(status=Status.SUCCEEDED)
     test_operator_2.set_status(status=Status.FAILED)
     test_operator_1.add_child(child_node=test_operator_2)
     self.assertTrue(test_operator_2.is_status_consistent())
示例#2
0
 def test_is_data_model_consistent_2(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.set_data_model(model=DataModelType.BATCH)
     test_operator_2.set_data_model(model=DataModelType.STREAMING)
     test_operator_1.add_child(child_node=test_operator_2)
     self.assertFalse(test_operator_2.is_data_model_consistent())
示例#3
0
 def test_is_status_consistent_1(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.set_status(status=Status.IDLE)
     test_operator_2.set_status(status=Status.RUNNING)
     test_operator_1.add_child(child_node=test_operator_2)
     self.assertFalse(test_operator_2.is_status_consistent())
示例#4
0
 def test_execution_1(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.add_child(child_node=test_operator_2)
     test_operator_1.set_status(status=Status.SUCCEEDED)
     test_operator_1.execute()
     self.assertEqual(test_operator_1.get_operator_snapshot().status, Status.SUCCEEDED)
示例#5
0
 def test_take_snapshot_1(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.set_status(status=Status.SUCCEEDED)
     test_operator_2.set_status(status=Status.FAILED)
     test_operator_1.add_child(child_node=test_operator_2)
     expected_node_snapshot = NodeSnapshot()
     expected_node_snapshot.node_name = 'test_operator_1'
     expected_node_snapshot.children_names.extend(['test_operator_2'])
     expected_operator_snapshot = OperatorSnapshot()
     expected_operator_snapshot.operator_name = 'test_operator_1'
     expected_operator_snapshot.data_model = DataModelType.DEFAULT
     expected_operator_snapshot.status = Status.SUCCEEDED
     expected_operator_snapshot.class_name = 'pslx.util.dummy_util.DummyOperator'
     expected_operator_snapshot.node_snapshot.CopyFrom(expected_node_snapshot)
     self.assertEqual(test_operator_1.get_operator_snapshot(), expected_operator_snapshot)
示例#6
0
 def test_set_data_model(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.set_data_model(model=DataModelType.BATCH)
     self.assertEqual(test_operator.get_data_model(), DataModelType.BATCH)
示例#7
0
 def test_wait_for_upstream_status(self):
     test_operator_1 = DummyUtil.dummy_operator(operator_name='test_operator_1')
     test_operator_2 = DummyUtil.dummy_operator(operator_name='test_operator_2')
     test_operator_1.add_child(child_node=test_operator_2)
     test_operator_1.set_status(status=Status.SUCCEEDED)
     self.assertListEqual(test_operator_2.wait_for_upstream_status(), [])
示例#8
0
 def test_is_done(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.set_status(status=Status.FAILED)
     self.assertFalse(test_operator.is_done())
示例#9
0
 def test_mark_as_done(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.mark_as_done()
     self.assertTrue(test_operator.is_done())
示例#10
0
 def test_unset_status(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.unset_status()
     self.assertEqual(test_operator.get_status(), Status.IDLE)
示例#11
0
 def test_set_status(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.set_status(status=Status.FAILED)
     self.assertEqual(test_operator.get_status(), Status.FAILED)
示例#12
0
 def test_unset_model(self):
     test_operator = DummyUtil.dummy_operator(operator_name='test_operator')
     test_operator.unset_data_model()
     self.assertEqual(test_operator.get_data_model(), DataModelType.DEFAULT)