Operator PythonOp

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.utility$PythonOp.svg

The PythonOp operator is used to call out to operators implemented in Python by using the Python Operator API.

In addition to the parameters listed, arbitrary constant parameters are allowed. These parameters are specific to the operator and can be read by the operator's class.

Checkpointed data

PythonOp is a wrapper operator, so the contents of its checkpoint depends on the implementation of the Python operator.

Behavior in a consistent region

PythonOp is a wrapper operator, so its behavior in a consistent region depends on the behavior that is defined by the used Python class.

Checkpointing behavior in an autonomous region

PythonOp is a wrapper operator, so its behavior in a autonomous region depends on the behavior that is defined by the used Python class.

Examples

This example uses the PythonOp operator.


// Invocation of Python operator using the the PythonOp operator                                 
// from the SPL toolkit.                                                                     
//                                                                                           
// Creates a stream containing the Python VM's system properties                               
stream<ustring name, ustring value, set<ustring> tags> SystemProperties                      
 = PythonOp()                                                                                  
{                                                                                            
  param                                                                                      
    // Module name of the Python Operator to be invoked.                                        
    // Set to the name of the file containing the Python Operator
    // without .py. This will be looked up in the impl/bin directory.
    //                                                                                       
    module : "MyPythonOperator";             
                                                          
    // PythonOp allows additional arbitrary parameters that                                    
    // are made available to the Operator instance through                                   
    // methods on the OperatorContext api, and in the constructor.
    // A parameter may have one or more values                                                                                                                                                           
    tagged: "python.";                                                                         
    tags: "system", "vm";                                                                    
}                         

Summary

Ports
This operator has 0 or more input ports and 0 or more output ports.
Windowing
This operator optionally accepts a windowing configuration.
Parameters
This operator supports arbitrary parameters in addition to 1 specific parameter.

Required: module

Metrics
This operator can report metrics.

Properties

Implementation
C++
Threading
Never - Operator never provides a single threaded execution context.

Input Ports

Ports (0...)

The PythonOp operator is configurable with zero or more input ports, which ingest the input tuples.

Properties

Output Ports

Assignments
This operator does not allow assignments to output attributes.
Ports (0...)

The PythonOp operator is configurable with zero or more output ports, which produce the submitted tuples.

Properties

Parameters

This operator supports arbitrary parameters in addition to 1 specific parameter.

Required: module

module

Specifies the module of the operator that is used to process and submit tuples.

Properties

Metrics

PythonOp is a wrapper operator, so any metrics reported depend on the implementation of the Python operator.

Libraries

python
Command: ../../../impl/bin/PythonOp_vmpath.sh
Library Name: streams-stdtk-pythonop
Include Path: ../../../impl/include
pthreads
Library Name: pthread
dl
Library Name: dl