def __init__(self, flux_handle=None, path=".", handle=None): dest = RAW.flux_kvsdir_destroy super(KVSDir.InnerWrapper, self).__init__( ffi, lib, handle=handle, match=ffi.typeof("flux_kvsdir_t *"), prefixes=["flux_kvsdir_"], destructor=dest, ) if flux_handle is None and handle is None: # pragma: no cover raise ValueError( "flux_handle must be a valid Flux object or " "handle must be a valid kvsdir cdata pointer" ) if handle is None: directory = ffi.new("flux_kvsdir_t *[1]") future = RAW.flux_kvs_lookup( flux_handle, None, RAW.FLUX_KVS_READDIR, path ) RAW.flux_kvs_lookup_get_dir(future, directory) self.handle = RAW.flux_kvsdir_copy(directory[0]) RAW.flux_future_destroy(future) if self.handle is None or self.handle == ffi.NULL: raise EnvironmentError("No such file or directory")
def __init__(self, flux_handle=None, path=".", handle=None): dest = RAW.flux_kvsdir_destroy super(KVSDir.InnerWrapper, self).__init__( ffi, lib, handle=handle, match=ffi.typeof("flux_kvsdir_t *"), prefixes=["flux_kvsdir_"], destructor=dest, ) if flux_handle is None and handle is None: # pragma: no cover raise ValueError( "flux_handle must be a valid Flux object or " "handle must be a valid kvsdir cdata pointer" ) if handle is None: directory = ffi.new("flux_kvsdir_t *[1]") future = RAW.flux_kvs_lookup( flux_handle, None, RAW.FLUX_KVS_READDIR, path ) RAW.flux_kvs_lookup_get_dir(future, directory) self.handle = RAW.flux_kvsdir_copy(directory[0]) RAW.flux_future_destroy(future) if self.handle is None or self.handle == ffi.NULL: raise EnvironmentError("No such file or directory")
def __init__(self, url=ffi.NULL, flags=0, handle=None): super(Flux, self).__init__( ffi, lib, handle=handle, match=ffi.typeof(lib.flux_open).result, filter_match=False, prefixes=["flux_", "FLUX_"], destructor=raw.flux_close, ) # Ensure reactor_depth is initialized for this thread if "reactor_depth" not in self.tls.__dict__: self.tls.reactor_depth = 0 self.tls.exception = None if handle is None: try: self.handle = raw.flux_open(url, flags) except EnvironmentError as err: raise EnvironmentError( err.errno, "Unable to connect to Flux: {}".format(err.strerror) ) self.aux_txn = None
def __init__(self, url=ffi.NULL, flags=0, handle=None): super(Flux, self).__init__( ffi, lib, handle=handle, match=ffi.typeof(lib.flux_open).result, filter_match=False, prefixes=["flux_", "FLUX_"], destructor=raw.flux_close, ) if handle is None: self.handle = raw.flux_open(url, flags) self.aux_txn = None
def __init__(self, url=ffi.NULL, flags=0, handle=None): super(Flux, self).__init__( ffi, lib, handle=handle, match=ffi.typeof(lib.flux_open).result, filter_match=False, prefixes=["flux_", "FLUX_"], destructor=raw.flux_close, ) if handle is None: self.handle = raw.flux_open(url, flags) self.aux_txn = None
def __init__(self, url=ffi.NULL, flags=0, handle=None): super(Flux, self).__init__( ffi, lib, handle=handle, match=ffi.typeof(lib.flux_open).result, filter_match=False, prefixes=["flux_", "FLUX_"], destructor=raw.flux_close, ) if handle is None: try: self.handle = raw.flux_open(url, flags) except EnvironmentError as err: raise EnvironmentError( err.errno, "Unable to connect to Flux: {}".format(err.strerror)) self.aux_txn = None
def __init__( self, flux_handle, name, flags=(RAW.KZ_FLAGS_READ | RAW.KZ_FLAGS_NONBLOCK), handle=None, prefix=False, ): self.destroyer = RAW.kz_close self.prefix = prefix if flux_handle is None and handle is None: # pragma: no cover raise ValueError( "flux_handle must be a valid Flux object or handle must " "be a valid kvsdir cdata pointer" ) if handle is None: handle = RAW.kz_open(flux_handle, name, flags) super(KZStream.InnerWrapper, self).__init__( ffi, lib, handle=handle, match=ffi.typeof("kz_t *"), prefixes=["kz_"] )
def __init__( self, flux_handle, name, flags=(RAW.KZ_FLAGS_READ | RAW.KZ_FLAGS_NONBLOCK), handle=None, prefix=False, ): self.destroyer = RAW.kz_close self.prefix = prefix if flux_handle is None and handle is None: # pragma: no cover raise ValueError( "flux_handle must be a valid Flux object or handle must " "be a valid kvsdir cdata pointer") if handle is None: handle = RAW.kz_open(flux_handle, name, flags) super(KZStream.InnerWrapper, self).__init__(ffi, lib, handle=handle, match=ffi.typeof("kz_t *"), prefixes=["kz_"])