This module gives users the ability to directly manage the Deephaven query execution context on threads, which is critical for applications to correctly launch deferred query evaluations, such as table update operations in threads.
- class ExecutionContext(j_exec_ctx)#
An ExecutionContext represents a specific combination of query library, query compiler, and query scope under which a query is evaluated.
A default, systemic ExecutionContext is created when a Deephaven script session is initialized, and it is used to evaluate queries submitted through this script session. However, to be able to evaluate a query in a deferred manner, such as in a different thread from the script session thread, an application must explicitly obtain or build a ExecutionContext and use it as a context manager to enclose the query in the body of the with statement.
Note that, a ExecutionContext can be shared among many threads. The most typical use pattern would be to obtain the script session’s systemic ExecutionContext and use it to wrap a query run in a thread created by the user.
Returns the current thread’s ExecutionContext.
- Return type:
Makes a new ExecutionContext based off the current thread’s ExecutionContext. The optional parameter freeze_vars should be a list of names in the current query scope. If it is provided, the resulting ExecutionContext will include a new query scope that is made up of only these names together with their current values. Future changes to the values of these names will not be visible in the new ExecutionContext.