def initialize(self, inputs: UnityInput) -> UnityOutput:
     try:
         # Establish communication grpc
         self.server = grpc.server(ThreadPoolExecutor(max_workers=10))
         self.unity_to_external = UnityToExternalServicerImplementation()
         add_UnityToExternalServicer_to_server(self.unity_to_external,
                                               self.server)
         self.server.add_insecure_port('[::]:' + str(self.port))
         self.server.start()
     except:
         raise UnityTimeOutException(
             "Couldn't start socket communication because worker number {} is still in use. "
             "You may need to manually close a previously opened environment "
             "or use a different worker number.".format(str(
                 self.worker_id)))
     if not self.unity_to_external.parent_conn.poll(30):
         raise UnityTimeOutException(
             "The Unity environment took too long to respond. Make sure that :\n"
             "\t The environment does not need user interaction to launch\n"
             "\t The Academy and the External Brain(s) are attached to objects in the Scene\n"
             "\t The environment and the Python interface have compatible versions."
         )
     aca_param = self.unity_to_external.parent_conn.recv().unity_output
     self.is_open = True
     message = UnityMessage()
     message.header.status = 200
     message.unity_input.CopyFrom(inputs)
     self.unity_to_external.parent_conn.send(message)
     self.unity_to_external.parent_conn.recv()
     return aca_param
 def initialize(self, inputs: UnityInput) -> UnityOutput:
     try:
         # Establish communication grpc
         self.server = grpc.server(ThreadPoolExecutor(max_workers=10))
         self.unity_to_external = UnityToExternalServicerImplementation()
         add_UnityToExternalServicer_to_server(self.unity_to_external, self.server)
         self.server.add_insecure_port('[::]:'+str(self.port))
         self.server.start()
     except :
         raise UnityTimeOutException(
             "Couldn't start socket communication because worker number {} is still in use. "
             "You may need to manually close a previously opened environment "
             "or use a different worker number.".format(str(self.worker_id)))
     if not self.unity_to_external.parent_conn.poll(30):
         raise UnityTimeOutException(
             "The Unity environment took too long to respond. Make sure that :\n"
             "\t The environment does not need user interaction to launch\n"
             "\t The Academy and the External Brain(s) are attached to objects in the Scene\n"
             "\t The environment and the Python interface have compatible versions.")
     aca_param = self.unity_to_external.parent_conn.recv().unity_output
     self.is_open = True
     message = UnityMessage()
     message.header.status = 200
     message.unity_input.CopyFrom(inputs)
     self.unity_to_external.parent_conn.send(message)
     self.unity_to_external.parent_conn.recv()
     return aca_param