Learn R Programming

RStorm (version 1.0)

GetTrack: Function to retrieve objects stored using the SetTrack functionality during a stream.

Description

Within bolts in a RStorm stream the TrackRow function can be used to store the state of variables at that point during the stream. The TrackRow function will store values incrementally during the stream. Thus, TrackRow enables one to store a set of parameter at each event in a Bolt. The current GetTrack function allows for inspection of these stored values after running the Stream by passing the RStorm result object.

Usage

GetTrack(name, x)

Arguments

name

a string with the name of the tracked parameter values. Name corresponds to the name used in the call to the TrackRow function during the stream.

x

a RStorm result object.

Value

a data.frame containing the parameters that are tracked at each iteration of a bolt.

See Also

See Also: TrackRow, SetHash, GetHash, GetTrackNames

Examples

Run this code
# NOT RUN {
# Create a topology with a spout
topology <- Topology(data.frame(x=c(1:10)))

# Add a bolt to the topology
computeSum <- function(x, ...){
	sum <- GetHash("sum")
	if(is.data.frame(sum)){
		x <- sum + (x[1])
	}
	SetHash("sum", x)
	# Track the current state during the stream:
	TrackRow("sum", data.frame(x=x))
}
topology <- AddBolt(topology, Bolt(computeSum))

# Run the stream
result <- RStorm(topology)

# Inspect the sums during the stream
GetTrack("sum", result)

# }

Run the code above in your browser using DataLab