def _receive_endpoint_call( self,endpoint_making_call,event_uuid,priority,func_name, result_queue,*args): ''' @param{_Endpoint object} endpoint_making_call --- The endpoint that made the endpoint call into this endpoint. @param {uuid} event_uuid --- @param {priority} priority @param {string} func_name --- The name of the Public function to execute (in the Waldo source file). @param {Queue.Queue} result_queue --- When the function returns, wrap it in a waldoEndpointCallResult._EndpointCallResult object and put it into this threadsafe queue. The endpoint that made the call is blocking waiting for the result of the call. @param {*args} *args --- additional arguments that the function requires. Called by another endpoint on this endpoint (not called by external non-Waldo code). Non-blocking. Requests the endpoint_service_thread to perform the endpoint function call listed as func_name. ''' self._stop_lock() # check if should short-circuit processing if self._stop_called: result_queue.push( waldoCallResults._StopAlreadyCalledEndpointCallResult()) self._stop_unlock() return self._stop_unlock() endpt_call_action = waldoServiceActions._ReceiveEndpointCallAction( self,endpoint_making_call,event_uuid,priority, func_name,result_queue,*args) self._thread_pool.add_service_action(endpt_call_action)
def service(self): act_evt_map = self.local_endpoint._act_event_map try: act_event = act_evt_map.get_or_create_endpoint_called_event( self.endpoint_making_call,self.event_uuid, self.priority,self.result_queue) except util.StoppedException: self.result_queue.put( waldoCallResults._StopAlreadyCalledEndpointCallResult()) return import waldo.lib.waldoVariableStore evt_ctx = waldoExecutingEvent._ExecutingEventContext( self.local_endpoint._global_var_store, # should not have any sequence local data from an endpoint # call. waldo.lib.waldoVariableStore._VariableStore( self.local_endpoint._host_uuid) ) # receiving endpoint must know that this call was an endpoint # call. This is so that it can ensure to make deep copies of # all non-external arguments (including lists,maps, and user # structs). evt_ctx.set_from_endpoint_true() exec_event = waldo.lib.waldoExecutingEvent._ExecutingEvent( self.to_exec,act_event,evt_ctx,self.result_queue, *self.args) # don't start as separte thread try: exec_event.run() except Exception as ex: # if hasattr(ex,'waldo_handled'): # # Already processed exception in put exception # return raise