def put_async(self, attr_or_items, value=None): """"puts a value or values into an attribute or attributes and returns immediately Args: attr_or_items (Attribute or Dict): The attribute or dictionary of {attributes: values} to set value (object): For single attr, the value set Returns: a list of futures to monitor when each put completes""" if value: attr_or_items = {attr_or_items: value} result_f = [] for attr, value in attr_or_items.items(): assert isinstance(attr, Attribute), \ "Expected Attribute, got %r" % (attr,) endpoint = attr.path_relative_to(self.process) + ["value"] request = Put(None, self.q, endpoint, value) f = Future(self) new_id = self._save_future(f) request.set_id(new_id) self.process.q.put(request) result_f.append(f) return result_f
def put(self, pv): self.log_debug("Put method called with: %s", pv) self._server.register_put(self._id, self) put_dict = pv.toDict() endpoints = [self._block] endpoints = endpoints + self.dict_to_path(put_dict) self.log_debug("Endpoints: %s", endpoints) values = self.dict_to_value(put_dict) msg = Put(response_queue=self._server.q, endpoint=endpoints, value=values) msg.set_id(self._id) with self._lock: self._server.send_to_process(msg) self.wait_for_reply() self._server.remove_put(self._id)
def put(self, pv): self.log_debug("Put method called with: %s", pv) self._server.register_put(self._id, self) put_dict = pv.toDict() endpoints = [self._block] endpoints = endpoints + self.dict_to_path(put_dict) self.log_debug("Endpoints: %s", endpoints) values = self.dict_to_value(put_dict) msg = Put(response_queue=self._server.q, endpoint=endpoints, value=values) msg.set_id(self._id) with self._lock: self._server.send_to_process(msg) self.wait_for_reply() self._server.remove_put(self._id)
def put(self, pv): # Null operation, the structure already contains the values self.log_debug("Put method called with: %s", pv) self.log_debug("Put method called with: %s", pv.toDict()) put_dict = pv.toDict() endpoints = [self._block] endpoints = endpoints + self.dict_to_path(put_dict) self.log_debug("Endpoints: %s", endpoints) values = self.dict_to_value(put_dict) msg = Put(response_queue=self._server.q, endpoint=endpoints, value=values) msg.set_id(self._id) self._server.send_to_process(msg) with self._lock: self.wait_for_reply() self.log_debug("Put method reply received") self._server.remove_put(self._id)