deephaven.update_graph

This module provides access to the Update Graph (UG)’s locks that must be acquired to perform certain table operations. When working with refreshing tables, UG locks must be held in order to have a consistent view of the data between table operations.

class UpdateGraph(j_update_graph)[source]

Bases: JObjectWrapper

An Update Graph handles table update propagation within the Deephaven query engine. It provides access to various control knobs and tools for ensuring consistency or blocking update processing.

j_object_type

alias of UpdateGraph

auto_locking = True

Whether to automatically acquire the Update Graph (UG) shared lock for an unsafe operation on a refreshing table when the current thread doesn’t own either the UG shared or the UG exclusive lock. The newly obtained lock will be released after the table operation finishes. Auto locking is turned on by default.

auto_locking_ctx(*args, **kwargs)[source]

An auto-locking aware context manager. It ensures that the enclosed code block runs under the UG shared lock if ugp.auto_locking is True, the target table-like object or any table-like arguments are refreshing, the current thread doesn’t own any UG lock, and the current thread is not part of the update graph.

auto_locking_op(f)[source]

A decorator for annotating unsafe Table operations. It ensures that the decorated function runs under the UG shared lock if ugp.auto_locking is True, the target table-like object or any table-like arguments are refreshing, the current thread doesn’t own any UG lock, and the current thread is not part of the update graph.

Return type:

Callable

exclusive_lock(ug)[source]

Context manager for running a block of code under an Update Graph (UG) exclusive lock.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

exclusive_locked(ug)[source]

A decorator that ensures the decorated function be called under the Update Graph (UG) exclusive lock. The lock is released after the function returns regardless of what happens inside the function.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

Return type:

Callable

has_exclusive_lock(ug)[source]

Checks if the current thread is holding the provided Update Graph’s (UG) exclusive lock.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

Return type:

bool

Returns:

True if the current thread is holding the Update Graph (UG) exclusive lock, False otherwise.

has_shared_lock(ug)[source]

Checks if the current thread is holding the provided Update Graph’s (UG) shared lock.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

Return type:

bool

Returns:

True if the current thread is holding the Update Graph (UG) shared lock, False otherwise.

shared_lock(ug)[source]

Context manager for running a block of code under an Update Graph (UG) shared lock.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

shared_locked(ug)[source]

A decorator that ensures the decorated function be called under the Update Graph (UG) shared lock. The lock is released after the function returns regardless of what happens inside the function.

Parameters:

ug (Union[UpdateGraph, Table, PartitionedTable, PartitionTableProxy]) – The Update Graph (UG) or a table-like object.

Return type:

Callable