Learn R Programming

RStorm (version 1.0)

GetTrackNames: Function to retrieve the names of all tracked objects using SetTrack

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 GetTrackNames function allows to inspect all the tracked objects of a stream by passing the RStorm result object.

Usage

GetTrackNames(x)

Arguments

x

a RStorm result object.

Value

A list of names of the tracked objects during the stream.

See Also

See Also: TrackRow, SetHash, GetHash, GetTrack

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
	GetTrackNames(result)

# }

Run the code above in your browser using DataLab