Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
added the ability to grab the auto-generated config data for a storag…
Browse files Browse the repository at this point in the history
…e client so we can create an Elasticsearch client that understands clusternames and hosts as defined in pio-env
  • Loading branch information
pferrel committed Sep 17, 2015
1 parent 5e48b6d commit 369b573
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions data/src/main/scala/io/prediction/data/storage/Storage.scala
Expand Up @@ -15,6 +15,8 @@

package io.prediction.data.storage

import java.lang.reflect.InvocationTargetException

import grizzled.slf4j.Logging
import io.prediction.annotation.DeveloperApi

Expand Down Expand Up @@ -208,8 +210,8 @@ object Storage extends Logging {
}

private def getClient(
clientConfig: StorageClientConfig,
pkg: String): BaseStorageClient = {
clientConfig: StorageClientConfig,
pkg: String): BaseStorageClient = {
val className = "io.prediction.data.storage." + pkg + ".StorageClient"
try {
Class.forName(className).getConstructors()(0).newInstance(clientConfig).
Expand All @@ -224,6 +226,13 @@ object Storage extends Logging {
}
}

/** Get the StorageClient config data from PIO Framework's environment variables */
def getConfig(sourceName: String): Option[StorageClientConfig] = {
if (s2cm.contains(sourceName) && s2cm.get(sourceName).nonEmpty && s2cm.get(sourceName).get.nonEmpty)
Some(s2cm.get(sourceName).get.get.config)
else None
}

private def updateS2CM(k: String, parallel: Boolean, test: Boolean):
Option[ClientMeta] = {
try {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
@@ -1 +1 @@
{"id":"AQUacEPKfAHhmU7wmxHErpEKiHwCJ1X0","version":"1d33d77ca11aaf0658d2f32e95d881007b406818","name":"PredictionIO","description":"pio-autogen-manifest","files":[],"engineFactory":""}
{"id":"ipNrDsdxAtsDjZHRSAqfgOTL0PztjuR3","version":"b6a10c9f995426f7ee739156066bc26b577f2f09","name":"pio","description":"pio-autogen-manifest","files":[],"engineFactory":""}

0 comments on commit 369b573

Please sign in to comment.