class_docstr: A client for connecting to a subclass of `rpc.Server`.
  
  Example:
      init_method = "file://myfile.tmp"
      num_clients = 1
      torch.distributed.init_process_group('gloo',
                                           init_method=init_method,
                                           world_size=num_clients + 1,
                                           rank=1)
  
      c = Client(MyServer, server_rank=0)
  
      print(c.test_func(torch.arange(0, 3), k=2))
      # ('the result is ', tensor([ 2,  3,  4]))
  
      c.join()
class_docstr_tok: ["A","client","for","connecting","to","a","subclass","of","`","rpc.Server","`",".","Example",":","init_method","=","``","file",":","\/\/myfile.tmp","''","num_clients","=","1","torch.distributed.init_process_group","(","'gloo","'",",","init_method=init_method",",","world_size=num_clients","+","1",",","rank=1",")","c","=","Client","(","MyServer",",","server_rank=0",")","print","(","c.test_func","(","torch.arange","(","0",",","3",")",",","k=2",")",")","#","(","'the","result","is","'",",","tensor","(","[","2",",","3",",","4","]",")",")","c.join","(",")"]
code: def __getattr__(self, name):
      if name not in dir(self.server_class):
          raise AttributeError(
              "%s has no attribute %s"
              % (self.server_class.__name__, name)
          )
      func = getattr(self.server_class, name)
      if not isinstance(func, type(lambda: 1)):  # FIXME
          raise TypeError("%s object is not callable" % (type(func)))
  
      def inner(*args, **kwargs):
          send((name, args, kwargs), self.server_rank)
          (is_exception, res), _src = recv(self.server_rank)
          if not is_exception:
              return res
          else:
              exc, exc_str = res
              print(exc_str, file=sys.stderr)
              raise exc
  
      return inner
  
file_path: PyTorch-BigGraph/torchbiggraph/rpc.py
imports: import io
  import sys
  import traceback
  import numpy
  import torch
  import torch.distributed
label_desc: Use image node_id 2 for calling the Client obj's underlying member method code with example usage: obj.__getattr__(name) and returns: inner, res