Ejemplo n.º 1
0
 def get_flux(self):
     # pylint: disable=cyclic-import
     flux_handle = self.pimpl.get_flux()
     if flux_handle == ffi.NULL:
         return None
     handle = flux.core.handle.Flux(handle=flux_handle)
     # increment reference count to prevent destruction of the underlying handle
     # (which is owned by the future) when the flux handle is garbage collected
     handle.incref()
     return handle
Ejemplo n.º 2
0
 def get_flux(self):
     try:
         # pylint: disable=cyclic-import
         flux_handle = self.pimpl.get_flux()
     except OSError as exc:
         #  get_flux() throws OSError of EINVAL if !f->h, but this should
         #   a valid return (i.e. no flux handle set yet)
         if exc.errno == errno.EINVAL:
             return None
         else:
             raise
     if flux_handle == ffi.NULL:
         return None
     handle = flux.core.handle.Flux(handle=flux_handle)
     # increment reference count to prevent destruction of the underlying handle
     # (which is owned by the future) when the flux handle is garbage collected
     handle.incref()
     return handle