Skip to content

Commit

Permalink
Changes after dry run on the VM
Browse files Browse the repository at this point in the history
  • Loading branch information
William Markito committed Aug 23, 2015
1 parent 2b3204f commit 843fca6
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
serverUrl=http://localhost:9000
geodeUrl=http://geode-server:8080
numberOfMessages=1000
geodeUrl=http://localhost:8888
numberOfMessages=500
delayInMs=300
symbol=TSLA
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
serverUrl=http://localhost:9000
geodeUrl=http://geode-server:8080
numberOfMessages=1000
geodeUrl=http://localhost:8888
numberOfMessages=500
delayInMs=300
symbol=TSLA
6 changes: 1 addition & 5 deletions FinanceStreamSimulator/startSimulator.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/bash

SIMULATOR_CONTAINER=`docker ps |grep -i java:7 | awk '{print $1}'`

echo Using Simulator container ID: $SIMULATOR_CONTAINER

docker exec $SIMULATOR_CONTAINER FinanceStreamSimulator/gradlew -p FinanceStreamSimulator run
gradle -p run


3 changes: 2 additions & 1 deletion SpringXD.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ xd:>stream all destroy

## Final step

* Before moving the to next lab run the script `stream-create.sh` from `$PROJECT/streaming/`
* Before moving the to next lab run the script
`stream-create.sh` from `$PROJECT/streaming/`
* After the script execute, access the following from a browser:
* http://192.168.56.10:9393/admin-ui/#/streams/definitions
* http://192.168.56.10:9393/admin-ui/#/streams/create
Expand Down
2 changes: 1 addition & 1 deletion StocksSpark/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion StocksSpark/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion StocksSpark/.idea/sbt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 33 additions & 8 deletions StocksSpark/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions StocksSpark/build.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")

name := "StocksSpark"
version := "1.0"
scalaVersion := "2.10.5"

// additional libraries
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % "1.3.1" % "provided",
"org.apache.spark" %% "spark-sql" % "1.3.1",
"org.apache.spark" %% "spark-streaming" % "1.3.1",
"org.apache.spark" %% "spark-mllib" % "1.3.1",
"org.apache.spark" %% "spark-sql" % "1.3.1" % "provided",
"org.apache.spark" %% "spark-streaming" % "1.3.1" % "provided",
"org.apache.spark" %% "spark-mllib" % "1.3.1" % "provided",
"org.apache.geode" % "gemfire-core" % "1.0.0-incubating-SNAPSHOT" excludeAll(ExclusionRule(organization = "org.jboss.netty")),
"io.pivotal.gemfire.spark" % "gemfire-spark-connector_2.10" % "0.5.0" excludeAll(ExclusionRule(organization = "org.apache.spark")),
"org.scalatest" %% "scalatest" % "2.2.1" % "test"
Expand All @@ -16,5 +18,8 @@ libraryDependencies ++= Seq(
resolvers ++= Seq(
"Apache Software Foundation" at "http://repository.apache.org/snapshots/",
"Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository",
Resolver.sonatypeRepo("public")
Resolver.sonatypeRepo("public"),
Resolver.url("bintray-sbt-plugins", url("http://dl.bintray.com/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
)

//assemblyJarName in assembly := s"${name.value}-${version.value}"
Binary file removed data/TSLA.gfd
Binary file not shown.
9 changes: 4 additions & 5 deletions streaming/stream-create.xd
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
admin config server http://localhost:9393

stream create process_sink --definition "queue:stocks > transform --script='file:streaming/transform.groovy' | object-to-json | gemfire-json-server --useLocator=true --host=localhost --port=10334 --regionName=Stocks --keyExpression=payload.getField('entryTimestamp')" --deploy
stream create process_sink --definition "queue:stocks > transform --script='file:./transform.groovy' | object-to-json | gemfire-json-server --useLocator=true --host=localhost --port=10334 --regionName=Stocks --keyExpression=payload.getField('entryTimestamp')" --deploy

stream create yahoo_finance_source --definition "trigger --cron='* * 7-13 * * MON-FRI' | http-client --url='''https://query.yahooapis.com/v1/public/yql?q=select Symbol, LastTradeDate, LastTradeTime, LastTradePriceOnly, DaysHigh, DaysLow, Open from yahoo.finance.quotes where symbol in (\"TSLA\")&format=json&env=store://datatables.org/alltableswithkeys''' --httpMethod=GET | splitter --expression=#jsonPath(payload,'$.query.results.quote') > queue:stocks" --deploy

stream create http_source --definition "http --port=9000 | splitter --expression=#jsonPath(payload,'$') > queue:stocks" --deploy

stream create --name r_process --definition "tap:stream:process_sink.transform > r-parsing: object-to-json | shell --command='Rscript streaming/tech_indicators.R' | formatting: splitter --expression=#jsonPath(payload,'$') | filter --expression=#jsonPath(payload,'$.rsi').indexOf('NaN')==-1 | object-to-json | gemfire-json-server --useLocator=true --host=locator --port=10334 --regionName=TechIndicators --keyExpression=payload.getField('entryTimestamp')" --deploy
stream create --name r_process --definition "tap:stream:process_sink.transform > r-parsing: object-to-json | shell --command='Rscript ./tech_indicators.R' | formatting: splitter --expression=#jsonPath(payload,'$') | filter --expression=#jsonPath(payload,'$.rsi').indexOf('NaN')==-1 | object-to-json | gemfire-json-server --useLocator=true --host=locator --port=10334 --regionName=TechIndicators --keyExpression=payload.getField('entryTimestamp')" --deploy

stream create --name prediction --definition "tap:stream:r_process.object-to-json > shell --command='./evaluate.sh' | gemfire-json-server --regionName=Predictions --host=localhost --port=10334 --useLocator=true --keyExpression=payload.getField('entryTimestamp')" --deploy

stream create --name training --definition "trigger --fixedDelay=300 | shell --command='./train.sh'" --deploy
stream create --name prediction --definition "tap:stream:r_process.object-to-json > shell --command='../evaluate.sh' | gemfire-json-server --regionName=Predictions --host=localhost --port=10334 --useLocator=true --keyExpression=payload.getField('entryTimestamp')" --deploy

# stream create --name training --definition "trigger --fixedDelay=300 | shell --command='../train.sh'" --deploy
2 changes: 1 addition & 1 deletion streaming/tech_indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ while(TRUE) {
streamRow <- fromJSON(line)


historical <- getURL(paste0('http://geode-server:8080/gemfire-api/v1/queries/adhoc?q=SELECT%20DISTINCT%20*%20FROM%20/Stocks%20s%20WHERE%20s.entryTimestamp%20<%20',streamRow$entryTimestamp,'l%20ORDER%20BY%20s.entryTimestamp%20desc%20LIMIT%20100'))
historical <- getURL(paste0('http://localhost:8888/gemfire-api/v1/queries/adhoc?q=SELECT%20DISTINCT%20*%20FROM%20/Stocks%20s%20WHERE%20s.entryTimestamp%20<%20',streamRow$entryTimestamp,'l%20ORDER%20BY%20s.entryTimestamp%20desc%20LIMIT%20100'))


historicalSet <- fromJSON(historical)
Expand Down

0 comments on commit 843fca6

Please sign in to comment.