Example control script

This simple but complete control script demonstrates how all of the Control Interpreter elements work together.

The control script is based on the reference implementation that is part of the Endeca installation, and is designed to run on a single machine. This example is for a Windows environment.

############################ Global Variables ###############################
#### Global variables can be reused anywhere in the control script, and 
#### certain global variables (such as jcd_port and working_dir) are used 
#### as defaults for the control interpreter.

# JCD connection
jcd_port = 8088
jcd_use_ssl  = false

# Dgraph and LogServer ports
#
# IMPORTANT NOTE: Although not required, Reference UI expects logserver to be 
# running on dgraph port +2
#
dgraph_port 	= 8000
logserver_port 	= 8002

# Reusable path variables
sample_wine_data_dir = $(endeca_root)..\reference\sample_wine_data

# Common operational variables for all bricks
working_machine = wine_indexer
working_dir     = $(sample_wine_data_dir)\data
stdout_base     = ..\logs\out.
stderr_base     = ..\logs\err.

# Location of Perl 5.8.3 binary (required for Fetch brick)
perl_binary = $(endeca_root)\perl\5.8.3\bin\perl.exe

############################ Bricks ########################################
#### Bricks define interfaces to various programs.
####
#### Endeca components such as forge, dgidx and dgraph have special bricks
#### that know about the process they are running.
####
#### For other user-defined actions, a Shell brick can be used to run any
#### system command.

# This brick defines the machine to be used for the data update process.
wine_indexer : Machine
				name = localhost

# This brick runs forge to process the raw data.
wine_forge : Forge
				pipeline = ..\data\forge_input\pipeline.epx
				forge_options = -vw 

# This brick runs dgidx to index the processed data.
wine_dgidx : Dgidx
				input  = ..\data\partition0\forge_output\wine
				output = ..\data\partition0\dgidx_output\wine

# This brick moves index files from dgidx_output to dgraph_input.
wine_fetch : Fetch
				source = file:///$(sample_wine_data_dir)\data\partition0\dgidx_output\*
				dest = .\partition0\dgraph_input
				remove_source = true

# This brick runs the dgraph, using the indices created by the
# wine_dgidx brick. Note that the global setting for working_dir
# has been overridden in this brick.
wine_dgraph : Dgraph
				working_dir = $(sample_wine_data_dir)\logs
				input = ..\data\partition0\dgraph_input\wine
				port = $(dgraph_port)

# This brick runs logserver to handle application logging requests.
wine_logserver : LogServer
				port            = $(logserver_port)
				log_file_prefix = $(sample_wine_data_dir)\logs\logserver_output\wine
	




# This brick generates an html report for all logs in a directory.
wine_genreport : ReportGenerator
				logs = $(sample_wine_data_dir)\logs\logserver_output\
				settings = $(sample_wine_data_dir)\etc\report_settings.xml
				stylesheet = $(sample_wine_data_dir)\etc\report_stylesheet.xsl
				output = $(sample_wine_data_dir)\reports\sample_report.html

# This brick generates an xml report for use by the business studio
wine_toolsreport : ReportGenerator
			logs = $(sample_wine_data_dir)\logs\logserver_output\
			settings = $(sample_wine_data_dir)\etc\report_settings.xml
			stylesheet = $(sample_wine_data_dir)\etc\tools_report_stylesheet.xsl
			output = $(sample_wine_data_dir)\reports\tools_report.xml
			timerange = "day-so-far"


############################ Scripts #######################################
#### Scripts are called to run each brick in the correct order to accomplish
#### tasks.

# This Script brick runs the entire data update sequence: process
# the data using forge, index the data using dgidx, stop the
# currently running dgraph and restart it using the new indices.
runme : Script
				wine_forge
				wine_dgidx
				if wine_dgraph.running
						wine_dgraph.stop
				wine_fetch
				wine_dgraph.start
				if wine_logserver.running
						wine_logserver.stop
				wine_logserver.start

# This Script brick stops and restarts the dgraph. This brick
# is useful in cases where the administrator wants to restart 
# the dgraph but does not need to rerun forge or dgidx.
dgraph_start : Script
				if wine_dgraph.running
						wine_dgraph.stop
				wine_dgraph.start

# This Script brick stops the dgraph if it is running.  This
# is useful when re-defining bricks on a running JCD
dgraph_stop : Script
				if wine_dgraph.running
						wine_dgraph.stop
# This Script brick stops and restarts the logserver. This brick
# is useful in cases where the administrator wants to restart 
# the logserver but does not need to rerun forge or dgidx or restart 
# the dgraph.
logserver_start : Script
				if wine_logserver.running
						wine_logserver.stop
				wine_logserver.start

# This Script brick rolls the log file generated by the LogServer. 
logserver_roll : Script
				wine_logserver.roll