public class PythonStreamer<S extends PythonSender,OUT> extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected Thread |
errorPrinter |
protected AbstractRichFunction |
function |
protected DataInputStream |
in |
protected static org.slf4j.Logger |
LOG |
protected AtomicReference<String> |
msg |
protected DataOutputStream |
out |
protected Thread |
outPrinter |
protected int |
port |
protected PythonReceiver<OUT> |
receiver |
protected S |
sender |
protected ServerSocket |
server |
protected static int |
SIGNAL_BUFFER_REQUEST |
protected static int |
SIGNAL_BUFFER_REQUEST_G0 |
protected static int |
SIGNAL_BUFFER_REQUEST_G1 |
protected static int |
SIGNAL_ERROR |
protected static int |
SIGNAL_FINISHED |
protected static byte |
SIGNAL_LAST |
protected Socket |
socket |
Constructor and Description |
---|
PythonStreamer(AbstractRichFunction function,
Configuration config,
int envID,
int setID,
boolean usesByteArray,
S sender) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this streamer.
|
static void |
destroyProcess(Process process) |
void |
open()
Starts the python script.
|
void |
sendBroadCastVariables(Configuration config)
Sends all broadcast-variables encoded in the configuration to the external process.
|
protected void |
sendReadConfirmation() |
protected void |
sendWriteNotification(int size,
boolean hasNext) |
protected static final org.slf4j.Logger LOG
protected static final int SIGNAL_BUFFER_REQUEST
protected static final int SIGNAL_BUFFER_REQUEST_G0
protected static final int SIGNAL_BUFFER_REQUEST_G1
protected static final int SIGNAL_FINISHED
protected static final int SIGNAL_ERROR
protected static final byte SIGNAL_LAST
protected transient ServerSocket server
protected transient Socket socket
protected transient DataInputStream in
protected transient DataOutputStream out
protected int port
protected S extends PythonSender sender
protected PythonReceiver<OUT> receiver
protected AtomicReference<String> msg
protected final AbstractRichFunction function
protected transient Thread outPrinter
protected transient Thread errorPrinter
public PythonStreamer(AbstractRichFunction function, Configuration config, int envID, int setID, boolean usesByteArray, S sender)
public void open() throws IOException
IOException
public void close() throws IOException
IOException
public static void destroyProcess(Process process) throws IOException
IOException
protected void sendWriteNotification(int size, boolean hasNext) throws IOException
IOException
protected void sendReadConfirmation() throws IOException
IOException
public final void sendBroadCastVariables(Configuration config) throws IOException
config
- configuration object containing broadcast-variable count and namesIOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.