Пример #1
0
 def test_invalid_runner(self):
     """Tests invalid runner."""
     with self.assertRaises(AttributeError):
         client._validate_runner(runner='FooRunner',
                                 project=self.test_project,
                                 region=self.test_region,
                                 tfrecorder_wheel=None)
Пример #2
0
 def test_local_path_with_dataflow_runner(self):
     """Tests DataflowRunner conflict with local path."""
     with self.assertRaises(AttributeError):
         client._validate_runner(self.df_test,
                                 runner='DataflowRunner',
                                 project=self.test_project,
                                 region=self.test_region)
Пример #3
0
 def test_gcs_path_with_dataflow_runner_missing_wheel(self):
     """Tests DataflowRunner with missing required whl path."""
     with self.assertRaises(AttributeError) as context:
         client._validate_runner(runner='DataflowRunner',
                                 project=self.test_project,
                                 region=self.test_region,
                                 tfrecorder_wheel=None)
         self.assertTrue(
             'requires a tfrecorder whl file for remote execution.' in repr(
                 context.exception))
Пример #4
0
 def test_gcs_path_with_dataflow_runner_missing_param(self):
     """Tests DataflowRunner with missing required parameter."""
     for p, r in [(None, self.test_region), (self.test_project, None),
                  (None, None)]:
         with self.assertRaises(AttributeError) as context:
             client._validate_runner(runner='DataflowRunner',
                                     project=p,
                                     region=r,
                                     tfrecorder_wheel=self.test_wheel)
         self.assertTrue(
             'DataflowRunner requires valid `project` and `region`' in repr(
                 context.exception))
Пример #5
0
 def test_gcs_path_with_dataflow_runner_missing_param(self):
     """Tests DataflowRunner with missing required parameter."""
     df2 = self.test_df.copy()
     df2[constants.IMAGE_URI_KEY] = 'gs://' + df2[constants.IMAGE_URI_KEY]
     for p, r in [(None, self.test_region), (self.test_project, None),
                  (None, None)]:
         with self.assertRaises(AttributeError) as context:
             client._validate_runner(df2,
                                     runner='DataflowRunner',
                                     project=p,
                                     region=r)
         self.assertTrue(
             'DataflowRunner requires valid `project` and `region`' in repr(
                 context.exception))
Пример #6
0
 def test_valid_runner(self):
     """Tests valid runner."""
     self.assertIsNone(
         client._validate_runner(runner='DirectRunner',
                                 project=self.test_project,
                                 region=self.test_region,
                                 tfrecorder_wheel=None))
Пример #7
0
 def test_valid_runner(self):
     """Tests valid runner."""
     self.assertIsNone(
         client._validate_runner(self.test_df,
                                 runner='DirectRunner',
                                 project=self.test_project,
                                 region=self.test_region))
Пример #8
0
 def test_gcs_path_with_dataflow_runner(self):
     """Tests DataflowRunner with GCS path."""
     df2 = self.test_df.copy()
     df2[constants.IMAGE_URI_KEY] = 'gs://' + df2[constants.IMAGE_URI_KEY]
     self.assertIsNone(
         client._validate_runner(df2,
                                 runner='DataflowRunner',
                                 project=self.test_project,
                                 region=self.test_region))