Package io.deephaven.integrations.python
Class PythonDeephavenSession
java.lang.Object
io.deephaven.util.referencecounting.ReferenceCounted
io.deephaven.engine.liveness.ReferenceCountedLivenessNode
io.deephaven.engine.liveness.LivenessScope
io.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
io.deephaven.integrations.python.PythonDeephavenSession
- All Implemented Interfaces:
io.deephaven.base.log.LogOutputAppendable,io.deephaven.engine.liveness.LivenessManager,io.deephaven.engine.liveness.LivenessNode,io.deephaven.engine.liveness.LivenessReferent,io.deephaven.engine.liveness.ReleasableLivenessManager,io.deephaven.engine.util.ScriptSession,io.deephaven.engine.util.VariableProvider,Serializable
public class PythonDeephavenSession
extends io.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
A ScriptSession that uses a JPy cpython interpreter internally.
This is used for applications or the console; Python code running remotely uses WorkerPythonEnvironment for it's supporting structures.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.deephaven.engine.util.AbstractScriptSession
io.deephaven.engine.util.AbstractScriptSession.ScriptSessionQueryScope, io.deephaven.engine.util.AbstractScriptSession.Snapshot, io.deephaven.engine.util.AbstractScriptSession.SynchronizedScriptSessionQueryScope, io.deephaven.engine.util.AbstractScriptSession.UnsynchronizedScriptSessionQueryScopeNested classes/interfaces inherited from interface io.deephaven.engine.util.ScriptSession
io.deephaven.engine.util.ScriptSession.Changes, io.deephaven.engine.util.ScriptSession.Listener -
Field Summary
FieldsFields inherited from class io.deephaven.engine.util.AbstractScriptSession
executionContext -
Constructor Summary
ConstructorsConstructorDescriptionPythonDeephavenSession(io.deephaven.engine.updategraph.UpdateGraph updateGraph, io.deephaven.engine.util.PythonScope<?> scope) Creates a Python "ScriptSession", for use where we should only be reading from the scope, such as an IPython kernel session.PythonDeephavenSession(io.deephaven.engine.updategraph.UpdateGraph updateGraph, io.deephaven.plugin.type.ObjectTypeLookup objectTypeLookup, @Nullable io.deephaven.engine.util.ScriptSession.Listener listener, boolean runInitScripts, io.deephaven.engine.util.PythonEvaluatorJpy pythonEvaluator) Create a Python ScriptSession. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected io.deephaven.engine.util.ScriptSession.ChangescreateDiff(PythonDeephavenSession.PythonSnapshot from, PythonDeephavenSession.PythonSnapshot to, RuntimeException e) protected PythonDeephavenSession.PythonSnapshotprotected void@NotNull ObjectgetVariable(String name) <T> TgetVariable(String name, T defaultValue) booleanhasVariableName(String name) io.deephaven.engine.context.QueryScopevoidonApplicationInitializationBegin(Supplier<io.deephaven.engine.util.scripts.ScriptPathLoader> pathLoader, io.deephaven.engine.util.scripts.ScriptPathLoaderState scriptLoaderState) voidvoidpopScope()voidpushScope(org.jpy.PyObject pydict) voidsetScriptPathLoader(Supplier<io.deephaven.engine.util.scripts.ScriptPathLoader> scriptPathLoader, boolean caching) booleansetUseOriginalScriptLoaderState(boolean useOriginal) voidsetVariable(String name, @Nullable Object newValue) protected PythonDeephavenSession.PythonSnapshotunwrapObject(Object object) Methods inherited from class io.deephaven.engine.util.AbstractScriptSession
applyDiff, applyVariableChangeToDiff, createScriptCache, destroy, evaluateScript, evaluateScript, getExecutionContext, getTableDefinition, getVariableProvider, getVariableType, observeScopeChanges, publishInitialMethods inherited from class io.deephaven.engine.liveness.LivenessScope
release, transferToMethods inherited from class io.deephaven.engine.liveness.ReferenceCountedLivenessNode
dropReference, getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryRetainReference, tryUnmanage, tryUnmanageMethods inherited from class io.deephaven.util.referencecounting.ReferenceCounted
append, decrementReferenceCount, forceReferenceCountToZero, getReferenceCountDebug, incrementReferenceCount, resetReferenceCount, toString, tryDecrementReferenceCount, tryIncrementReferenceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.deephaven.engine.liveness.LivenessManager
manage, tryManageMethods inherited from interface io.deephaven.engine.liveness.LivenessNode
tryUnmanage, tryUnmanage, unmanage, unmanageMethods inherited from interface io.deephaven.engine.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReferenceMethods inherited from interface io.deephaven.engine.liveness.ReleasableLivenessManager
releaseMethods inherited from interface io.deephaven.engine.util.ScriptSession
evaluateScript, sanitizeThrowable
-
Field Details
-
SCRIPT_TYPE
-
-
Constructor Details
-
PythonDeephavenSession
public PythonDeephavenSession(io.deephaven.engine.updategraph.UpdateGraph updateGraph, io.deephaven.plugin.type.ObjectTypeLookup objectTypeLookup, @Nullable @Nullable io.deephaven.engine.util.ScriptSession.Listener listener, boolean runInitScripts, io.deephaven.engine.util.PythonEvaluatorJpy pythonEvaluator) throws IOException Create a Python ScriptSession.- Parameters:
updateGraph- the default update graph to install for the replobjectTypeLookup- the object type lookuplistener- an optional listener that will be notified whenever the query scope changesrunInitScripts- if init scripts should be executedpythonEvaluator-- Throws:
IOException- if an IO error occurs running initialization scripts
-
PythonDeephavenSession
public PythonDeephavenSession(io.deephaven.engine.updategraph.UpdateGraph updateGraph, io.deephaven.engine.util.PythonScope<?> scope) Creates a Python "ScriptSession", for use where we should only be reading from the scope, such as an IPython kernel session.
-
-
Method Details
-
newQueryScope
@VisibleForTesting public io.deephaven.engine.context.QueryScope newQueryScope()- Specified by:
newQueryScopein classio.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
-
getVariable
@NotNull public @NotNull Object getVariable(String name) throws io.deephaven.engine.context.QueryScope.MissingVariableException - Throws:
io.deephaven.engine.context.QueryScope.MissingVariableException
-
getVariable
-
pushScope
@ScriptApi public void pushScope(org.jpy.PyObject pydict) -
popScope
@ScriptApi public void popScope() -
evaluate
- Specified by:
evaluatein classio.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
-
getVariables
-
emptySnapshot
- Specified by:
emptySnapshotin classio.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
-
takeSnapshot
- Specified by:
takeSnapshotin classio.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
-
createDiff
protected io.deephaven.engine.util.ScriptSession.Changes createDiff(PythonDeephavenSession.PythonSnapshot from, PythonDeephavenSession.PythonSnapshot to, RuntimeException e) - Specified by:
createDiffin classio.deephaven.engine.util.AbstractScriptSession<PythonDeephavenSession.PythonSnapshot>
-
getVariableNames
-
hasVariableName
-
setVariable
-
scriptType
-
onApplicationInitializationBegin
public void onApplicationInitializationBegin(Supplier<io.deephaven.engine.util.scripts.ScriptPathLoader> pathLoader, io.deephaven.engine.util.scripts.ScriptPathLoaderState scriptLoaderState) -
onApplicationInitializationEnd
public void onApplicationInitializationEnd() -
setScriptPathLoader
public void setScriptPathLoader(Supplier<io.deephaven.engine.util.scripts.ScriptPathLoader> scriptPathLoader, boolean caching) -
clearScriptPathLoader
public void clearScriptPathLoader() -
setUseOriginalScriptLoaderState
public boolean setUseOriginalScriptLoaderState(boolean useOriginal) -
unwrapObject
-