/  Python Yamcs Client  /  General Client  /  Futures

Futures

class yamcs.core.futures.WebSocketSubscriptionFuture(manager)

Bases: concurrent.futures._base.Future

Future for capturing the asynchronous execution of a WebSocket subscription.

Initializes the future. Should not be called by clients.

add_done_callback(fn)

Attaches a callable that will be called when the future finishes.

Args:
fn: A callable that will be called with this future as its only

argument when the future completes or is cancelled. The callable will always be called by a thread in the same process in which it was added. If the future has already completed or been cancelled then the callable will be called immediately. These callables are called in the order that they were added.

cancel()

Closes the websocket and shutdowns the background thread consuming messages.

cancelled()

Return True if the future was cancelled.

done()

Return True of the future was cancelled or finished executing.

exception(timeout=None)

Return the exception raised by the call that the future represents.

Args:
timeout: The number of seconds to wait for the exception if the

future isn’t done. If None, then there is no limit on the wait time.

Returns:

The exception raised by the call that the future represents or None if the call completed without raising.

Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.

reply(timeout=None)

Returns the initial reply. This is emitted before any subscription data is emitted. This function raises an exception if the subscription attempt failed.

result(timeout=None)

Return the result of the call that the future represents.

Args:
timeout: The number of seconds to wait for the result if the future

isn’t done. If None, then there is no limit on the wait time.

Returns:

The result of the call that the future represents.

Raises:

CancelledError: If the future was cancelled. TimeoutError: If the future didn’t finish executing before the given

timeout.

Exception: If the call raised then that exception will be raised.

running()

Return True if the future is currently executing.

set_exception(exception)

Sets the result of the future as being the given exception.

Should only be used by Executor implementations and unit tests.

set_result(result)

Sets the return value of work associated with the future.

Should only be used by Executor implementations and unit tests.