-
- All Superinterfaces:
MetadataContext
public interface ExecutionContext extends MetadataContext
Execution context passed toExecutableOperator.execute(ExecutionContext)
. This contains methods for looking up physical ports associated with logical ports and other execution-time information.- See Also:
ExecutableOperator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Path
allocateTemporaryStorage()
Allocates space for storing a temporary file or files.DistributedCallableContext
getDistributedCallableContext()
Public only as a matter if implementation; operator authors should not invoke this method.FileClient
getFileClient()
Returns the file client to be used within the graphPhysicalInputPort
getInputPort(LogicalPort logicalPort)
Returns the physical port for the given logical port.PhysicalInputPort
getInputPort(LogicalPort logicalPort, int copyNumber)
Returns the physical port for the given logical port.IOMonitoringContext
getIOMonitor()
Returns a monitoring context to allow I/O operators to report statistics.NodeAllocationPlan
getNodeAllocation()
Returns the initial node allocation for the graph to which this operator belongs.PhysicalOutputPort
getOutputPort(LogicalPort logicalPort)
Returns the physical port for the given logical port.PartitionInstanceInfo
getPartitionInfo()
Returns partition id information for the partition being executed.RecordInputSelector
getRecordInputSelector(List<RecordInput> inputs)
Creates a selector over the specified inputs.StatisticsRegistry
getStatisticsRegistry()
Returns a statistics registry that can be used for registering custom statistics.LogicalGraph
newSubgraph()
Creates a new subgraph to use within this execution context.LogicalGraph
newSubgraph(String name)
Creates a new subgraph to use within this execution context.-
Methods inherited from interface com.pervasive.datarush.operators.MetadataContext
getCombinedMetadata, getEngineConfig, getMaxParallelism, getPath, getRequiredMetadata, getSourceMaxParallelism, getSourceMetadata, isParallel, isSourceConnected, isSourceParallel
-
-
-
-
Method Detail
-
getFileClient
FileClient getFileClient()
Returns the file client to be used within the graphThe resulting client is initially instrumented using the monitoring context returned from
getIOMonitor()
. Therefore file I/O statistics will be collected by default on any file opened using the client.- Specified by:
getFileClient
in interfaceMetadataContext
- Returns:
- the file client to be used for all file access
-
getPartitionInfo
PartitionInstanceInfo getPartitionInfo()
Returns partition id information for the partition being executed. Most operators should not need to call this method since their output will tend to be a function of the input. This is commonly used for I/O operators which, for example, must chose the output file name based on the partition ID.- Returns:
- partition id information for the partition being executed.
-
getInputPort
PhysicalInputPort getInputPort(LogicalPort logicalPort)
Returns the physical port for the given logical port. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses ofLogicalPort
. For example://get the physical port for the "input" RecordPort input.
getInput
(ctx)- Parameters:
logicalPort
- the logical input port- Returns:
- the physical port
-
getInputPort
PhysicalInputPort getInputPort(LogicalPort logicalPort, int copyNumber)
Returns the physical port for the given logical port. This is a rarely-used method, for processes that need multiple readers for a given input. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses ofLogicalPort
. For example://get the physical port for the "input" RecordPort input.
getInput
(ctx,copyNumber)- Parameters:
logicalPort
- the logical input portcopyNumber
- the copy number- Returns:
- the physical port
-
getOutputPort
PhysicalOutputPort getOutputPort(LogicalPort logicalPort)
Returns the physical port for the given logical port. Note that operators should generally not call this method directly. Rather they should use one of the type-safe/convenience methods on the various subclasses ofLogicalPort
. For example://get the physical port for the "output" RecordPort output.
getOutput
(ctx)- Parameters:
logicalPort
- the logical output port- Returns:
- the physical port
-
getIOMonitor
IOMonitoringContext getIOMonitor()
Returns a monitoring context to allow I/O operators to report statistics.- Returns:
- a monitoring context
-
getNodeAllocation
NodeAllocationPlan getNodeAllocation()
Returns the initial node allocation for the graph to which this operator belongs.- Returns:
- the node allocation
-
allocateTemporaryStorage
Path allocateTemporaryStorage()
Allocates space for storing a temporary file or files. The returned path is guaranteed to be unique and can be safely used as a file or as a base path for temporary files. Files so created are stored within the temporary storage locations specified by the engine configuration.The temporary storage is not valid for use outside the scope of the
ExecutableOperator.execute(ExecutionContext)
method. The caller is responsible for cleaning up any files written in the allocated location, even on failure of the executing graph. It is therefore recommended to wrap the using code in the scope of a try-finally block.- Returns:
- a path to use as the base location for any temporary files
-
getDistributedCallableContext
DistributedCallableContext getDistributedCallableContext()
Public only as a matter if implementation; operator authors should not invoke this method. Returns the distributed callable context in which we are being executed.- Returns:
- the distributed context
-
getStatisticsRegistry
StatisticsRegistry getStatisticsRegistry()
Returns a statistics registry that can be used for registering custom statistics.- Returns:
- the statistics registry.
-
newSubgraph
LogicalGraph newSubgraph()
Creates a new subgraph to use within this execution context. The subgraph will have its default engine config set to the same value returned byMetadataContext.getEngineConfig()
. Statistics calculated by the subgraph will be aggregated and will appear in the statistics of this operator.- Returns:
- a new subgraph
-
newSubgraph
LogicalGraph newSubgraph(String name)
Creates a new subgraph to use within this execution context. The subgraph will have its default engine config set to the same value returned byMetadataContext.getEngineConfig()
. Statistics calculated by the subgraph will be aggregated and will appear in the statistics of this operator.- Parameters:
name
- the name of the subgraph- Returns:
- a new subgraph
-
getRecordInputSelector
RecordInputSelector getRecordInputSelector(List<RecordInput> inputs)
Creates a selector over the specified inputs. This selector can be used to wait for data to arrive on any of the input ports.- Parameters:
inputs
- the set of input ports to register with the selector- Returns:
- a new selector for waiting on inputs
-
-