def continuation_callback(c_future, opaque_handle): try: py_future: "Future" = ffi.from_handle(opaque_handle) assert c_future == py_future.pimpl.handle if not py_future.stopped: py_future.then_cb(py_future, *py_future.then_args, **py_future.then_kwargs) # pylint: disable=broad-except except Exception as exc: # # Uncaught exceptions stop reactor with error. # Setting the exception in the global Flux handle class will cause # the handle to re-throw the exception after leaving the reactor: # flux_handle = py_future.get_flux() type(flux_handle).set_exception(exc) flux_handle.reactor_stop_error() finally: _THEN_HANDLES[py_future] -= 1 if _THEN_HANDLES[py_future] <= 0: # allow future object to be garbage collected now that all # registered callbacks have completed py_future.cb_handle = None del _THEN_HANDLES[py_future]
def timeout_handler_wrapper(unused1, unused2, revents, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) try: watcher.callback(watcher.flux_handle, watcher, revents, watcher.args) # pylint: disable=broad-except except Exception as exc: type(watcher.flux_handle).set_exception(exc) watcher.flux_handle.reactor_stop_error()
def message_handler_wrapper(unused1, unused2, msg_handle, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) watcher.callback( watcher.flux_handle, watcher, Message(handle=msg_handle, destruct=False), watcher.args, )
def continuation_callback(c_future, opaque_handle): try: py_future = ffi.from_handle(opaque_handle) assert c_future == py_future.pimpl.handle py_future.then_cb(py_future, py_future.then_arg) finally: # allow future object to be garbage collected now that all # registered callbacks have completed py_future.cleanup_then()
def signal_handler_wrapper(_unused1, _unused2, _unused3, opaque_handle): watcher = ffi.from_handle(opaque_handle) try: signal_int = raw.signal_watcher_get_signum(watcher.handle) watcher.callback(watcher.flux_handle, watcher, signal_int, watcher.args) # pylint: disable=broad-except except Exception as exc: type(watcher.flux_handle).set_exception(exc) watcher.flux_handle.reactor_stop_error()
def continuation_callback(c_future, opaque_handle): try: py_future: "Future" = ffi.from_handle(opaque_handle) assert c_future == py_future.pimpl.handle py_future.then_cb(py_future, py_future.then_arg) finally: _THEN_HANDLES[py_future] -= 1 if _THEN_HANDLES[py_future] <= 0: # allow future object to be garbage collected now that all # registered callbacks have completed py_future.cb_handle = None del _THEN_HANDLES[py_future]
def message_handler_wrapper(unused1, unused2, msg_handle, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) try: watcher.callback( watcher.flux_handle, watcher, Message(handle=msg_handle), watcher.args, ) # pylint: disable=broad-except except Exception as exc: type(watcher.flux_handle).set_exception(exc) watcher.flux_handle.reactor_stop_error()
def signal_handler_wrapper(_unused1, _unused2, _unused3, opaque_handle): watcher = ffi.from_handle(opaque_handle) signal_int = raw.signal_watcher_get_signum(watcher.handle) watcher.callback(watcher.flux_handle, watcher, signal_int, watcher.args)
def fd_handler_wrapper(unused1, unused2, revents, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) fd_int = raw.fd_watcher_get_fd(watcher.handle) watcher.callback(watcher.flux_handle, watcher, fd_int, revents, watcher.args)
def timeout_handler_wrapper(handle_trash, timer_watcher_s, revents, opaque_handle): watcher = ffi.from_handle(opaque_handle) ret = watcher.cb(watcher.fh, watcher, revents, watcher.args)
def message_handler_wrapper(handle_trash, m_watcher_t, msg_handle, opaque_handle): watcher = ffi.from_handle(opaque_handle) ret = watcher.cb(watcher.fh, watcher, flux.message.Message(handle=msg_handle, destruct=False), watcher.args)
def timeout_handler_wrapper(unused1, unused2, revents, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) watcher.callback(watcher.flux_handle, watcher, revents, watcher.args)
def cb_then_wrapper(trash, arg): rpc_handle = ffi.from_handle(arg) callback(rpc_handle, rpc_handle.then_args)
def timeout_handler_wrapper(handle_trash, watcher_s, revents, opaque_handle): watcher = ffi.from_handle(opaque_handle) ret = watcher.cb(watcher.fh, watcher, revents, watcher.args)
def fd_handler_wrapper(handle_trash, fd_watcher_s, revents, opaque_handle): watcher = ffi.from_handle(opaque_handle) fd_int = raw.fd_watcher_get_fd(watcher.handle) ret = watcher.cb(watcher.fh, watcher, fd_int, revents, watcher.args)
def signal_handler_wrapper(unused1, unused2, revents, opaque_handle): del unused1, unused2 # unused arguments watcher = ffi.from_handle(opaque_handle) signal_int = raw.signal_watcher_get_signum(watcher.handle) watcher.callback(watcher.flux_handle, watcher, signal_int, watcher.args)