Working with multiple applications
Different main composites can be compiled under the same application directory, by customizing the output directory for the individual invocations of the SPL compiler.
For example, assume that there are two potential main composites, namely
my.sample::Importer
and my.sample::Exporter
. They
can be compiled in the application directory, with the sc
command as
follows:
sc -M spl.sample::Importer --output-directory=output/importer
sc -M spl.sample::Exporter --output-directory=output/exporter
The --output-directory
option is used to change the default location of the
output directory, which contains the generated artifacts, including the application bundle file. The sc
command also provides a --data-directory
option, which can be used to change the default location of the data directory.
A typical makefile for building multiple applications in the application directory is given as follows:
.PHONY: all importer exporter clean clean-importer clean-exporter
SPLC = $(STREAMS_INSTALL)/bin/sc
SPLC_FLAGS ?= -a
SPLC_FLAGS_importer ?= $(SPLC_FLAGS)
SPLC_FLAGS_exporter ?= $(SPLC_FLAGS)
SPL_DATA_DIR ?= ./data
SPL_CMD_ARGS ?=
SPL_CMD_ARGS_importer ?= $(SPL_CMD_ARGS)
SPL_CMD_ARGS_exporter ?= $(SPL_CMD_ARGS)
SPL_MAIN_COMPOSITE_importer = sample::Importer
SPL_MAIN_COMPOSITE_exporter = sample::Exporter
SPL_OUTPUT_DIR_importer = output/importer
SPL_OUTPUT_DIR_exporter = output/exporter
all: importer exporter
importer:
$(SPLC) $(SPLC_FLAGS_importer) -M $(SPL_MAIN_COMPOSITE_importer) --data-directory $(SPL_DATA_DIR) --output-directory=$(SPL_OUTPUT_DIR_importer) $(SPL_CMD_ARGS_importer)
exporter:
$(SPLC) $(SPLC_FLAGS_exporter) -M $(SPL_MAIN_COMPOSITE_exporter) --output-directory=$(SPL_OUTPUT_DIR_exporter) $(SPL_CMD_ARGS_exporter)
clean: clean-importer clean-exporter
clean-importer:
$(SPLC) $(SPLC_FLAGS_importer) -C -M $(SPL_MAIN_COMPOSITE_importer) --output-directory=$(SPL_OUTPUT_DIR_importer)
clean-exporter:
$(SPLC) $(SPLC_FLAGS_exporter) -C -M $(SPL_MAIN_COMPOSITE_exporter) --output-directory=$(SPL_OUTPUT_DIR_exporter)
The generated applications can be submitted to the Teracloud® Streams instance as jobs. You can submit these jobs as individual steps, as shown in this example:
streamtool submitjob output/importer/my.sample.Importer.sab # submit job for one
streamtool submitjob output/exporter/my.sample.Exporter.sab # submit job for the other