Enum Class WorkerPythonEnvironment
- All Implemented Interfaces:
Serializable
,Comparable<WorkerPythonEnvironment>
,java.lang.constant.Constable
It is a singleton that contains an instance of a PythonHolder. All of the specially handled db operations from a remote Python session should execute queries which interact with this class. The script sessions that run for PersistentQueries or consoles are handled separately by the IrisDbPythonSession.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiondoEval
(PythonEvalQuery pythonEvalQuery) Evaluates one or more statements in the context of our python environment.doQuery
(Database db, com.fishlib.io.logger.Logger log, PythonRemoteQuery pythonRemoteQuery) Executes a Remote Query sent by Python.Retrieves a value from our Python holder's globals.boolean
pushClass
(PythonPushClassQuery pythonPushClassQuery) Loads a class that was dilled by the remote Python process into our environment.static WorkerPythonEnvironment
Returns the enum constant of this class with the specified name.static WorkerPythonEnvironment[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
pushClass
Loads a class that was dilled by the remote Python process into our environment.- Parameters:
pythonPushClassQuery
- the query containing the dilled Python object- Returns:
- true if successful (because remote queries need to have a return value)
-
doEval
Evaluates one or more statements in the context of our python environment.Intended for debugging problems with your remote Python session.
- Parameters:
pythonEvalQuery
- the remote query containing the python String to evaluate.- Returns:
- true if successful (because remote queries need to have a return value)
-
fetch
Retrieves a value from our Python holder's globals.When the object is a convertible PyObject; we return the PyObject. Otherwise, we'll return a PythonRemoteQuery.PickledResult, which is suitable for unpickling by the remote side.
The caller should never serialize an unconverted PyObject; it contains a raw pointer and will result in a Hotspot or memory corruption on the remote side.
- Parameters:
name
- the variable to retrieve- Returns:
- the variable as a Java object; or pickled
-
doQuery
public Object doQuery(Database db, com.fishlib.io.logger.Logger log, PythonRemoteQuery pythonRemoteQuery) Executes a Remote Query sent by Python.The PythonRemoteQuery object contains the dilledObject from the remote side; and through the magic of duck typing anything that contains an execute method just happens to be a remote query.
We set the database, decode the original object and call the execute method with db as a parameter. The return value is stuck in a variable, which we then fetch and return as the result.
- Parameters:
db
- the database to execute againstlog
- our log objectpythonRemoteQuery
- the remote query containing the Python dilled object- Returns:
- the result of the execute method from within Python, appropriate converted for sending over the wire
-