Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into embed-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mofojed committed Dec 14, 2023
2 parents 8b47fa7 + 482cd8e commit 91e3fe5
Show file tree
Hide file tree
Showing 74 changed files with 1,503 additions and 647 deletions.
50 changes: 35 additions & 15 deletions .github/workflows/docs-ci-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,36 @@ on:
branches: [ 'main', 'release/v*' ]

jobs:
makedirs:
runs-on: ubuntu-22.04
steps:
- name: Make Directories
run: |
mkdir -p tmp-deephaven-core-v2/${{ github.ref_name }}/
cd tmp-deephaven-core-v2/${{ github.ref_name }}/
mkdir -p javadoc pydoc client-api
cd client-api
mkdir -p javascript python cpp-examples cpp r
- name: Deploy Directories
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz
path: tmp-deephaven-core-v2/
remote_path: deephaven-core-v2/
remote_host: ${{ secrets.DOCS_HOST }}
remote_port: ${{ secrets.DOCS_PORT }}
remote_user: ${{ secrets.DOCS_USER }}
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}
symlink:
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v') }}
needs: [javadoc, typedoc, pydoc, cppdoc, rdoc]
runs-on: ubuntu-22.04
concurrency:
group: symlink-${{ github.workflow }}-${{ github.ref }}
# We don't want to cancel in-progress jobs against main because that might leave the upload in a bad state.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Make Symlinks
run: |
mkdir -p tmp-deephaven-core-v2/symlinks;
mkdir -p tmp-deephaven-core-v2/symlinks
cd tmp-deephaven-core-v2/symlinks
ln -s ../${{ github.ref_name }} latest
ln -s ../main next
Expand All @@ -37,6 +52,7 @@ jobs:
remote_user: ${{ secrets.DOCS_USER }}
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}
javadoc:
needs: [makedirs]
runs-on: ubuntu-22.04
concurrency:
group: javadoc-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -90,7 +106,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: combined-javadoc/build/docs/javadoc/
remote_path: deephaven-core-v2/${{ github.ref_name }}/javadoc/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -99,6 +115,7 @@ jobs:
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}

typedoc:
needs: [makedirs]
runs-on: ubuntu-22.04
concurrency:
group: typedoc-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -147,7 +164,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: web/client-api/types/build/documentation/
remote_path: deephaven-core-v2/${{ github.ref_name }}/client-api/javascript/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -156,6 +173,7 @@ jobs:
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}

pydoc:
needs: [makedirs]
runs-on: ubuntu-22.04
concurrency:
group: pydoc-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -216,7 +234,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: sphinx/build/docs/
remote_path: deephaven-core-v2/${{ github.ref_name }}/pydoc/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -228,7 +246,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: sphinx/build/pyclient-docs/
remote_path: deephaven-core-v2/${{ github.ref_name }}/client-api/python/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -245,6 +263,7 @@ jobs:
if-no-files-found: ignore

cppdoc:
needs: [makedirs]
runs-on: ubuntu-22.04
concurrency:
group: cppdoc-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -298,7 +317,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: sphinx/build/cppClientDocs/
remote_path: deephaven-core-v2/${{ github.ref_name }}/client-api/cpp/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -310,7 +329,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: sphinx/build/cppExamplesDocs/
remote_path: deephaven-core-v2/${{ github.ref_name }}/client-api/cpp-examples/
remote_host: ${{ secrets.DOCS_HOST }}
Expand All @@ -319,6 +338,7 @@ jobs:
remote_key: ${{ secrets.DEEPHAVEN_CORE_SSH_KEY }}

rdoc:
needs: [makedirs]
runs-on: ubuntu-22.04
concurrency:
group: rdoc-${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -365,7 +385,7 @@ jobs:
if: ${{ github.event_name == 'push' }}
uses: burnett01/[email protected]
with:
switches: -rlptDvz --mkpath --delete
switches: -rlptDvz --delete
path: R/rdeephaven/docs/
remote_path: deephaven-core-v2/${{ github.ref_name }}/client-api/r/
remote_host: ${{ secrets.DOCS_HOST }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.deephaven.util.SafeCloseable;
import io.deephaven.util.annotations.ScriptApi;
import io.deephaven.util.annotations.VisibleForTesting;
import io.deephaven.util.thread.ThreadInitializationFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jpy.KeyError;
Expand Down Expand Up @@ -76,11 +77,12 @@ public class PythonDeephavenSession extends AbstractScriptSession<PythonSnapshot
*/
public PythonDeephavenSession(
final UpdateGraph updateGraph,
final ThreadInitializationFactory threadInitializationFactory,
final ObjectTypeLookup objectTypeLookup,
@Nullable final Listener listener,
final boolean runInitScripts,
final PythonEvaluatorJpy pythonEvaluator) throws IOException {
super(updateGraph, objectTypeLookup, listener);
super(updateGraph, threadInitializationFactory, objectTypeLookup, listener);

evaluator = pythonEvaluator;
scope = pythonEvaluator.getScope();
Expand Down Expand Up @@ -108,9 +110,9 @@ public PythonDeephavenSession(
* Creates a Python "{@link ScriptSession}", for use where we should only be reading from the scope, such as an
* IPython kernel session.
*/
public PythonDeephavenSession(
final UpdateGraph updateGraph, final PythonScope<?> scope) {
super(updateGraph, NoOp.INSTANCE, null);
public PythonDeephavenSession(final UpdateGraph updateGraph,
final ThreadInitializationFactory threadInitializationFactory, final PythonScope<?> scope) {
super(updateGraph, threadInitializationFactory, NoOp.INSTANCE, null);

evaluator = null;
this.scope = (PythonScope<PyObject>) scope;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,21 @@
package io.deephaven.util.thread;

import io.deephaven.configuration.Configuration;

import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.Collection;

/**
* Extension point to allow threads that will run user code from within the platform to be controlled by configuration.
*/
public interface ThreadInitializationFactory {
/* private */ String[] CONFIGURED_INITIALIZATION_TYPES =
Configuration.getInstance().getStringArrayFromProperty("thread.initialization");
/* private */ List<ThreadInitializationFactory> INITIALIZERS = Arrays.stream(CONFIGURED_INITIALIZATION_TYPES)
.filter(str -> !str.isBlank())
.map(type -> {
try {
// noinspection unchecked
Class<? extends ThreadInitializationFactory> clazz =
(Class<? extends ThreadInitializationFactory>) Class.forName(type);
return clazz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException
| InstantiationException | IllegalAccessException e) {

// TODO (https://github.com/deephaven/deephaven-core/issues/4040):
// Currently the default property file is shared between both the java client and the server. This
// means that client-side usage will attempt to load the thread.initialization property intended for
// the server which is not available on the class path.
if (e instanceof ClassNotFoundException && type.startsWith("io.deephaven.server.")) {
return null;
}

throw new IllegalArgumentException(
"Error instantiating initializer " + type + ", please check configuration", e);
}
})
.filter(Objects::nonNull)
.collect(Collectors.toUnmodifiableList());
ThreadInitializationFactory NO_OP = r -> r;

/**
* Chains configured initializers to run before/around any given runnable, returning a runnable intended to be run
* by a new thread.
*/
static Runnable wrapRunnable(Runnable runnable) {
Runnable acc = runnable;
for (ThreadInitializationFactory INITIALIZER : INITIALIZERS) {
acc = INITIALIZER.createInitializer(acc);
}
return acc;
static ThreadInitializationFactory of(Collection<ThreadInitializationFactory> factories) {
return runnable -> {
Runnable acc = runnable;
for (ThreadInitializationFactory factory : factories) {
acc = factory.createInitializer(acc);
}
return acc;
};
}

Runnable createInitializer(Runnable runnable);
Expand Down
Loading

0 comments on commit 91e3fe5

Please sign in to comment.