|
41 | 41 | from apache_beam.runners.dataflow.dataflow_runner import DataflowRuntimeException |
42 | 42 | from apache_beam.runners.dataflow.dataflow_runner import _check_and_add_missing_options |
43 | 43 | from apache_beam.runners.dataflow.dataflow_runner import _check_and_add_missing_streaming_options |
| 44 | +from apache_beam.runners.dataflow.dataflow_runner import _is_runner_v2_disabled |
44 | 45 | from apache_beam.runners.dataflow.internal.clients import dataflow as dataflow_api |
45 | 46 | from apache_beam.runners.internal import names |
46 | 47 | from apache_beam.runners.runner import PipelineState |
@@ -734,5 +735,27 @@ def test_explicit_streaming_no_unbounded(self): |
734 | 735 | apiclient.dataflow.Job.TypeValueValuesEnum.JOB_TYPE_STREAMING) |
735 | 736 |
|
736 | 737 |
|
| 738 | +class DataflowRunnerV2DisabledTest(unittest.TestCase): |
| 739 | + |
| 740 | + def test_runner_v2_disabled_experiments_raise(self): |
| 741 | + disable_experiments = [ |
| 742 | + 'disable_portable_runner', |
| 743 | + 'enable_streaming_java_runner', |
| 744 | + 'disable_runner_v2', |
| 745 | + 'disable_runner_v2_until_2023', |
| 746 | + 'disable_runner_v2_until_v2.50', |
| 747 | + 'disable_prime_runner_v2', |
| 748 | + ] |
| 749 | + for experiment in disable_experiments: |
| 750 | + options = PipelineOptions([f'--experiments={experiment}']) |
| 751 | + self.assertTrue( |
| 752 | + _is_runner_v2_disabled(options), |
| 753 | + f'Expected {experiment} to disable runner v2') |
| 754 | + with self.assertRaisesRegex( |
| 755 | + ValueError, |
| 756 | + 'Disabling Runner V2 no longer supported'): |
| 757 | + DataflowRunner().run_pipeline(None, options) |
| 758 | + |
| 759 | + |
737 | 760 | if __name__ == '__main__': |
738 | 761 | unittest.main() |
0 commit comments