public class InterpreterUtils extends Object
Important: This class loads the jython runtime which is essentially one big singleton. We make the core assumption here that this class is loaded by separate ClassLoaders for each job or task allowing multiple instances of jython to exist in the same JVM without affecting each other.
Modifier and Type | Method and Description |
---|---|
static <X> X |
deserializeFunction(RuntimeContext context,
byte[] serFun)
Deserialize the given python function.
|
static void |
initAndExecPythonScript(PythonEnvironmentFactory factory,
Path scriptDirectory,
String scriptName,
String[] args)
Initializes the Jython interpreter and executes a python script.
|
public static <X> X deserializeFunction(RuntimeContext context, byte[] serFun) throws FlinkException
context
- the RuntimeContext of the java functionserFun
- serialized python UDFFlinkException
- if the deserialization failedpublic static void initAndExecPythonScript(PythonEnvironmentFactory factory, Path scriptDirectory, String scriptName, String[] args)
factory
- environment factoryscriptDirectory
- the directory containing all required user python scriptsscriptName
- the name of the main python scriptargs
- Command line arguments that will be delivered to the executed python scriptCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.