-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from IBMStreams/develop
1.5.1
- Loading branch information
Showing
67 changed files
with
2,330 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/runTTF/ | ||
*StreamsLogs*.tgz | ||
*.pyc | ||
*output/ | ||
*toolkit.xml | ||
*done* | ||
*__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<project name="MonitoringTests" default="test"> | ||
|
||
<target name="clean"> | ||
<ant dir="spl-test" target="clean"> | ||
</ant> | ||
</target> | ||
|
||
<target name="test" depends="spl-test"> | ||
</target> | ||
|
||
<target name="spl-test"> | ||
<ant dir="spl-test"> | ||
</ant> | ||
</target> | ||
|
||
</project> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright (C) 2017, International Business Machines Corporation. | ||
# All Rights Reserved. | ||
|
||
.PHONY: build all clean distributed | ||
|
||
SPLC_FLAGS = -a | ||
OUTPUT_DIR = output | ||
ifeq ($(STREAMS_INSTALL),) | ||
$(error error: environment variable STREAMS_INSTALL has to be set) | ||
endif | ||
STREAMSX_MONITORING_TOOLKIT ?=../../../../com.ibm.streamsx.monitoring | ||
SPLC = $(STREAMS_INSTALL)/bin/sc | ||
SPL_PATH = $(STREAMSX_MONITORING_TOOLKIT) | ||
SPLC_FLAGS += -t $(SPL_PATH) | ||
SPL_DATA_DIR = ./data | ||
|
||
SPL_CMD_ARGS ?= | ||
SPL_MAIN_COMPOSITE = Monitor | ||
SPL_MAIN_COMPOSITE1 = SampleJob | ||
|
||
build: distributed | ||
|
||
all: clean build | ||
|
||
distributed: | ||
$(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) $(SPL_CMD_ARGS) --data-directory $(SPL_DATA_DIR) --output-directory=$(OUTPUT_DIR)/monitor | ||
$(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE1) $(SPL_CMD_ARGS) --data-directory $(SPL_DATA_DIR) --output-directory=$(OUTPUT_DIR)/sample | ||
|
||
clean: | ||
$(SPLC) $(SPLC_FLAGS) -C -M $(SPL_MAIN_COMPOSITE) | ||
rm -rf $(OUTPUT_DIR) | ||
|
||
configure: | ||
-streamtool rmappconfig --noprompt com.ibm.streamsx.monitoring.jobs.JobStatusMonitor.ApplicationConfiguration | ||
streamtool mkappconfig --property user=$(JMX_USER) --property password=$(JMX_PASSWORD) com.ibm.streamsx.monitoring.jobs.JobStatusMonitor.ApplicationConfiguration | ||
|
||
start-sample: | ||
streamtool submitjob output/sample/SampleJob.sab --jobname sampleAppConfigJobStatus | ||
|
||
start-monitor: | ||
streamtool submitjob output/monitor/Monitor.sab --jobname monitorAppConfigJobStatus -P applicationConfigurationName=com.ibm.streamsx.monitoring.jobs.JobStatusMonitor.ApplicationConfiguration | ||
|
||
stop-sample: | ||
streamtool canceljob --jobnames sampleAppConfigJobStatus --force | ||
|
||
stop-monitor: | ||
streamtool canceljob --jobnames monitorAppConfigJobStatus --collectlogs | ||
|
96 changes: 96 additions & 0 deletions
96
tests/spl-test/JobStatusMonitor/test_app_config/Monitor.spl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// **************************************************************************** | ||
// * Copyright (C) 2017, International Business Machines Corporation * | ||
// * All rights reserved. * | ||
// **************************************************************************** | ||
// | ||
|
||
|
||
use com.ibm.streamsx.monitoring.jobs::*; | ||
use com.ibm.streamsx.monitoring.jmx::ConnectionNotification; | ||
|
||
/** | ||
* This sample application demonstrates the usage of the JobStatusMonitor operator and monitors all jobs and reports the Job/PE status events | ||
* | ||
* @param applicationConfigurationName | ||
* Specifies the name of [https://www.ibm.com/support/knowledgecenter/en/SSCRJU_4.2.0/com.ibm.streams.admin.doc/doc/creating-secure-app-configs.html|application configuration object] that can contain domainId, connectionURL, user, password, and filterDocument properties. The application configuration overrides values that are specified with the corresponding parameters. | ||
* | ||
* @param user | ||
* Specifies the user that is required for the JMX connection. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value. | ||
* | ||
* @param password | ||
* Specifies the password that is required for the JMX connection. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value. | ||
* | ||
* @param filterDocument | ||
* Specifies the either a path to a JSON-formatted document or a JSON-formatted String that specifies the domain, instance and job filters as regular expressions. Each regular expression must follow the rules that are specified for Java [https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html|Pattern]. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value. | ||
* If parameter is not set, then all jobs in current domain and instance are monitored. | ||
* | ||
* @param connectionURL | ||
* Specifies the connection URL as returned by the `streamtool getjmxconnect` command. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value.If not specified and the domainId parameter value equals the domain id under which this operator is running, then the operator uses the `streamtool getjmxconnect` command to get the value. | ||
* | ||
* @param domainId | ||
* Specifies the domain id that is monitored. If no domain id is specified, the domain id under which this operator is running is used. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value. | ||
* | ||
* @param sslOption | ||
* Specifies the sslOption that is required for the JMX connection. If the **applicationConfigurationName** parameter is specified, the application configuration can override this parameter value. If not specified and the domainId parameter value equals the domain id under which this operator is running, then the operator uses the `streamtool getdomainproperty` command to get the value. | ||
*/ | ||
composite Monitor { | ||
|
||
param | ||
expression<rstring> $applicationConfigurationName: getSubmissionTimeValue("applicationConfigurationName", ""); // optional, if user and password are set | ||
expression<rstring> $user: getSubmissionTimeValue("user", ""); // optional, if set in application configuration | ||
expression<rstring> $password: getSubmissionTimeValue("password", ""); // optional, if set in application configuration | ||
expression<rstring> $filterDocument: getSubmissionTimeValue("filterDocument", ""); // uses default, if not set | ||
expression<rstring> $connectionURL: getSubmissionTimeValue("connectionURL", ""); // optional, if not set, then domain settings are used, where the PE is running | ||
expression<rstring> $domainId: getSubmissionTimeValue("domainId", ""); // optional, if not set, then domain settings are used, where the PE is running | ||
expression<rstring> $sslOption: getSubmissionTimeValue("sslOption", ""); // optional, if not set, then domain settings are used, where the PE is running | ||
|
||
graph | ||
|
||
/* | ||
* The JobStatusMonitor generates a tuple for each notified PE status change. | ||
*/ | ||
(stream<JobStatusNotification> ChangeNotifications; | ||
stream<ConnectionNotification> ConnectionNotifications | ||
) = JobStatusMonitor() { | ||
param | ||
applicationConfigurationName: $applicationConfigurationName; | ||
user: $user; | ||
password: $password; | ||
filterDocument: $filterDocument; | ||
connectionURL: $connectionURL; | ||
domainId: $domainId; | ||
sslOption: $sslOption; | ||
} | ||
|
||
/* | ||
* Verify the received notifications. | ||
*/ | ||
(stream <rstring result> SaveDone1) as ChangeNotificationTracer = Custom(ChangeNotifications as I; ConnectionNotifications as C) { | ||
logic | ||
state: { | ||
mutable boolean done1Sent = false; | ||
} | ||
onTuple I: { | ||
printStringLn((rstring)I); | ||
if (I.notifyType == "com.ibm.streams.management.pe.changed") { | ||
if (!done1Sent) { | ||
submit({result="TEST_RESULT_PASS"}, SaveDone1); | ||
submit(Sys.WindowMarker, SaveDone1); | ||
done1Sent = true; | ||
} | ||
} | ||
} | ||
onTuple C: { | ||
printStringLn((rstring)C); | ||
} | ||
} | ||
|
||
() as Done1 = FileSink(SaveDone1 as I) { | ||
param file: "done_1"; format: csv; flush: 1u; quoteStrings : false; writePunctuations: false; closeMode: punct; moveFileToDirectory: dataDirectory()+"/.."; | ||
} | ||
|
||
config | ||
placement : partitionColocation("MONITOR"); | ||
|
||
} |
Oops, something went wrong.