Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Support for Multiple Update Graph Processors #3506

Merged
merged 87 commits into from
Jun 3, 2023

Conversation

nbauernfeind
Copy link
Member

@nbauernfeind nbauernfeind commented Mar 8, 2023

Here is some sample Groovy usage:

import io.deephaven.util.SafeCloseable
import io.deephaven.engine.util.TableTools
import io.deephaven.engine.updategraph.impl.PeriodicUpdateGraph
import io.deephaven.engine.context.ExecutionContext

oobUpdateGraph = PeriodicUpdateGraph.newBuilder("OOB").numUpdateThreads(1).build()
try (SafeCloseable ignored = ExecutionContext.getContext().withUpdateGraph(oobUpdateGraph).open()) {
    t = TableTools.timeTable("PT00:00:00.1").tail(1)
}

Observe that the table still ticks when the REPL is holding the exclusive DEFAULT PUG lock:

Thread.sleep(20000)
println("done")

Note that as-is the UGP stops and does not propagate a stop-related error notification to source table listeners. We might want to do something to be clear that the tables are done. We cannot purely set reference count to zero as this does not propagate downstream. I did try out such a change, but it some tests that were not expecting liveness referents / artifacts to fail manage calls.

Nightlies: https://github.com/nbauernfeind/deephaven-core/actions/runs/4789971295

@devinrsmith
Copy link
Member

I haven't reviewed this PR, but I have done a quick migration of io.deephaven.app.GcApplication to use its own UGP; I was able to verify that the GcApplication was able to tick while the main UGP was busy.

@nbauernfeind nbauernfeind modified the milestones: Mar 2023, Apr 2023 Mar 23, 2023
chipkent
chipkent previously approved these changes Mar 24, 2023
chipkent
chipkent previously approved these changes Apr 19, 2023
Copy link
Member

@rcaudy rcaudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High level review. Suggested some refactoring, and a change to the policy that determines UGP for derived tables.

@rcaudy
Copy link
Member

rcaudy commented May 8, 2023

We discussed in-person about maybe just having the idea of an UpdateGraph object that hides the "processor" details, with a clock(), sharedLock(), exclusiveLock(), and other appropriate interfaces exposed. LogicalClock should probably have an interface that does not expose the mutating methods.

@mofojed
Copy link
Member

mofojed commented May 30, 2023

@rcaudy Is this targeting June release now?

@nbauernfeind nbauernfeind force-pushed the multi_ugp branch 3 times, most recently from 23c89d8 to 7b5320c Compare June 1, 2023 18:21
@rcaudy rcaudy force-pushed the multi_ugp branch 2 times, most recently from ce90980 to aeedeb9 Compare June 2, 2023 00:09
rcaudy
rcaudy previously approved these changes Jun 3, 2023
Copy link
Member

@rcaudy rcaudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Please don't merge unless nightlies are green.

@@ -36,6 +37,10 @@ class ExecutionContext(JObjectWrapper, ContextDecorator):
def j_object(self) -> jpy.JType:
return self.j_exec_ctx

@property
def update_graph(self) -> _JUpdateGraph:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

@@ -537,6 +539,15 @@ def is_refreshing(self) -> bool:
self._is_refreshing = self.j_table.isRefreshing()
return self._is_refreshing

@property
def update_graph(self) -> _JUpdateGraph:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

@@ -2298,6 +2309,11 @@ def table(self) -> Table:
self._table = Table(j_table=self.j_partitioned_table.table())
return self._table

@property
def update_graph(self) -> _JUpdateGraph:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

@@ -2554,6 +2570,11 @@ def is_refreshing(self) -> bool:
"""Whether this proxy represents a refreshing partitioned table."""
return self.target.is_refreshing

@property
def update_graph(self) -> _JUpdateGraph:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

@@ -237,25 +238,29 @@ def modified_columns(self) -> List[str]:
return list(cols) if cols else []


def _do_locked(f: Callable, lock_type="shared") -> None:
"""Executes a function while holding the UpdateGraphProcessor (UGP) lock. Holding the UGP lock
def _do_locked(ug: Union[_JUpdateGraph, Table], f: Callable, lock_type="shared") -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

be released after the table operation finishes. Auto locking is turned on by default."""


def has_exclusive_lock(ug: Union[_JUpdateGraph, "Table", "PartitionedTable", "PartitionTableProxy"]) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two problems:

  1. The API is exposing Java objects to the user.
  2. The type hint is referring to a private variable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many places in this file.

chipkent
chipkent previously approved these changes Jun 3, 2023
…s after failure

2. Add PeriodicUpdateGraph caching by name, and re-use when providing via Dagger
3. Add proper unit test for update graph conflicts
4. Fix bug in update graph provision for merge and partitioned table construction
@rcaudy rcaudy dismissed stale reviews from chipkent and themself via 61ae914 June 3, 2023 14:16
rcaudy
rcaudy previously approved these changes Jun 3, 2023
@rcaudy rcaudy enabled auto-merge (squash) June 3, 2023 14:45
@rcaudy rcaudy disabled auto-merge June 3, 2023 14:45
@rcaudy rcaudy enabled auto-merge (squash) June 3, 2023 14:48
@rcaudy rcaudy dismissed their stale review June 3, 2023 14:48

Waiting on nightlies

@rcaudy rcaudy merged commit ec85c5b into deephaven:main Jun 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2023
@deephaven-internal
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants