Example #1
0
 def test_constructs_remote_context(self):
   targets = ['fake_target']
   channels = [
       executor_bindings.create_insecure_grpc_channel(t) for t in targets
   ]
   context = cpp_execution_contexts.create_remote_cpp_execution_context(
       channels=channels)
   self.assertIsInstance(context, context_base.Context)
 def test_executor_construction_raises_no_channels_available(
         self, container_constructor):
     with self.assertRaisesRegex(Exception, 'UNAVAILABLE'):
         executor_stack_bindings.create_remote_executor_stack(
             channels=container_constructor([
                 executor_bindings.create_insecure_grpc_channel(t)
                 for t in _TARGET_LIST
             ]),
             cardinalities=_CARDINALITIES)
Example #3
0
 def test_create_remote_cpp_factory_constructs(self):
     targets = ['localhost:8000', 'localhost:8001']
     channels = [
         executor_bindings.create_insecure_grpc_channel(t) for t in targets
     ]
     remote_cpp_factory = cpp_executor_factory.remote_cpp_executor_factory(
         channels=channels, default_num_clients=0)
     self.assertIsInstance(remote_cpp_factory,
                           executor_factory.ExecutorFactory)
Example #4
0
 def test_create_remote_cpp_factory_raises_with_no_available_workers(self):
     targets = ['localhost:8000', 'localhost:8001']
     channels = [
         executor_bindings.create_insecure_grpc_channel(t) for t in targets
     ]
     remote_cpp_factory = cpp_executor_factory.remote_cpp_executor_factory(
         channels=channels, default_num_clients=0)
     self.assertIsInstance(remote_cpp_factory,
                           executor_factory.ExecutorFactory)
     with self.assertRaises(Exception):
         remote_cpp_factory.create_executor({placements.CLIENTS: 1})
Example #5
0
 def test_insecure_channel_construction(self):
     remote_ex = executor_bindings.create_remote_executor(
         executor_bindings.create_insecure_grpc_channel(
             'localhost:{}'.format(portpicker.pick_unused_port())),
         cardinalities={placements.CLIENTS: 10})
     self.assertIsInstance(remote_ex, executor_bindings.Executor)