def __init__( self, flux_handle, topic, payload=None, nodeid=flux.constants.FLUX_NODEID_ANY, flags=0, ): # hold a reference for destructor ordering self._handle = flux_handle dest = raw.flux_future_destroy super(RPC.InnerWrapper, self).__init__( ffi, lib, handle=None, match=ffi.typeof(lib.flux_rpc).result, prefixes=["flux_rpc_"], destructor=dest, ) if isinstance(flux_handle, Wrapper): flux_handle = flux_handle.handle topic = encode_topic(topic) payload = encode_payload(payload) self.handle = raw.flux_rpc(flux_handle, topic, payload, nodeid, flags)
def __init__(self, flux_handle, topic, payload=None, rankset="all", flags=0): # hold a reference for destructor ordering self._handle = flux_handle dest = raw.flux_mrpc_destroy super(MRPC.InnerWrapper, self).__init__( ffi, lib, handle=None, match=ffi.typeof(lib.flux_mrpc).result, prefixes=["flux_mrpc_"], destructor=dest, ) # pylint: disable=duplicate-code if isinstance(flux_handle, Wrapper): flux_handle = flux_handle.handle topic = encode_topic(topic) payload = encode_payload(payload) rankset = encode_rankset(rankset) self.handle = raw.flux_mrpc(flux_handle, topic, payload, rankset, flags)
def event_subscribe(self, topic): """Subscribe to events :param topic: The event's topic to subscribe to :type topic: str, bytes, or unicode :raises EnvironmentError: if the topic is None or NULL :raises TypeError: if the topic is not a str, bytes, or unicode """ return self.flux_event_subscribe(encode_topic(topic))
def __init__( self, flux_handle, topic, payload=None, nodeid=flux.constants.FLUX_NODEID_ANY, flags=0, ): if isinstance(flux_handle, Wrapper): # keep the flux_handle alive for the lifetime of the RPC self.flux_handle = flux_handle flux_handle = flux_handle.handle topic = encode_topic(topic) payload = encode_payload(payload) future_handle = raw.flux_rpc(flux_handle, topic, payload, nodeid, flags) super(RPC, self).__init__(future_handle, prefixes=["flux_rpc_", "flux_future_"])
def topic(self, value): topic = encode_topic(value) self.pimpl.set_topic(topic)