コード例 #1
0
ファイル: future.py プロジェクト: tpatki/flux-core
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]
コード例 #2
0
ファイル: watchers.py プロジェクト: tpatki/flux-core
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()
コード例 #3
0
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,
    )
コード例 #4
0
ファイル: message.py プロジェクト: grondo/flux-core
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,
    )
コード例 #5
0
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()
コード例 #6
0
ファイル: watchers.py プロジェクト: tpatki/flux-core
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()
コード例 #7
0
ファイル: future.py プロジェクト: nickhrdy/flux-core
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]
コード例 #8
0
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()
コード例 #9
0
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)
コード例 #10
0
ファイル: watchers.py プロジェクト: trws/flux-core
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)
コード例 #11
0
ファイル: watchers.py プロジェクト: dinesh121991/flux-core
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)
コード例 #12
0
ファイル: watchers.py プロジェクト: dinesh121991/flux-core
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)
コード例 #13
0
ファイル: watchers.py プロジェクト: trws/flux-core
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)
コード例 #14
0
ファイル: rpc.py プロジェクト: trws/flux-core
 def cb_then_wrapper(trash, arg):
     rpc_handle = ffi.from_handle(arg)
     callback(rpc_handle, rpc_handle.then_args)
コード例 #15
0
ファイル: watchers.py プロジェクト: tpatki/flux-core
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)
コード例 #16
0
ファイル: watchers.py プロジェクト: tpatki/flux-core
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)
コード例 #17
0
ファイル: watchers.py プロジェクト: tpatki/flux-core
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)
コード例 #18
0
 def cb_then_wrapper(trash, arg):
     rpc_handle = ffi.from_handle(arg)
     callback(rpc_handle, rpc_handle.then_args)
コード例 #19
0
ファイル: watchers.py プロジェクト: nickhrdy/flux-core
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)
コード例 #20
0
ファイル: watchers.py プロジェクト: trws/flux-core
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)
コード例 #21
0
ファイル: watchers.py プロジェクト: trws/flux-core
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)