U
- type of update message read/writtenpublic abstract class AbstractServingModelManager<U> extends Object implements ServingModelManager<U>
ServingModelManager
that provides several default implementations.Modifier | Constructor and Description |
---|---|
protected |
AbstractServingModelManager(com.typesafe.config.Config config) |
Modifier and Type | Method and Description |
---|---|
void |
consume(Iterator<KeyMessage<String,U>> updateIterator,
org.apache.hadoop.conf.Configuration hadoopConf)
Called by the framework to initiate a continuous process of reading models, and reading
from the input topic and updating model state in memory, and issuing updates to the
update topic.
|
void |
consumeKeyMessage(String key,
U message,
org.apache.hadoop.conf.Configuration hadoopConf)
Convenience method that is called by the default implementation of
consume(Iterator, Configuration) , to process one key-message pair. |
com.typesafe.config.Config |
getConfig() |
boolean |
isReadOnly() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getModel
protected AbstractServingModelManager(com.typesafe.config.Config config)
config
- Oryx Config
objectpublic com.typesafe.config.Config getConfig()
getConfig
in interface ServingModelManager<U>
public boolean isReadOnly()
isReadOnly
in interface ServingModelManager<U>
public void consume(Iterator<KeyMessage<String,U>> updateIterator, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
ServingModelManager
consume
in interface ServingModelManager<U>
updateIterator
- iterator to read models fromhadoopConf
- Hadoop context, which may be required for reading from HDFSIOException
- if an error occurs while reading updatespublic void consumeKeyMessage(String key, U message, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
consume(Iterator, Configuration)
, to process one key-message pair.
It does nothing, except log the message. This should generally be overridden
if and only if consume(Iterator, Configuration)
is not.key
- key to process (non-null)message
- message to processhadoopConf
- Hadoop configuration for processIOException
- if an error occurs while processing the messageCopyright © 2014–2018. All rights reserved.