com.opendatagroup.hadrian.jvmcompiler

PFAEngine

trait PFAEngine[INPUT <: AnyRef, OUTPUT <: AnyRef] extends AnyRef

Interface for a Hadrian scoring engine.

Create instances using one of PFAEngine's "static" methods, then call begin once, action once for each datum in the data stream, and end once (if the stream ever ends). The rest of the functions are for

Examples:

Load a PFA file as a scoring engine. Note the .head to extract the single scoring engine from the Seq this function returns.

import com.opendatagroup.hadrian.jvmcompiler.PFAEngine
val engine = PFAEngine.fromJson(new java.io.File("myModel.pfa")).head

Assuming (and verifying) that method is map, run it over an Avro data stream.

import com.opendatagroup.hadrian.ast.Method
assert(engine.method == Method.MAP)

val inputDataStream = engine.avroInputIterator(new java.io.FileInputStream("inputData.avro"))
val outputDataStream = engine.avroOutputDataStream(new java.io.File("outputData.avro"))

engine.begin()
while (inputDataStream.hasNext)
  outputDataStream.append(engine.action(inputDataStream.next()))
engine.end()
outputDataStream.close()

Handle the case of method = emit engines (map and fold are the same).

import com.opendatagroup.hadrian.jvmcompiler.PFAEmitEngine
engine match {
  case emitEngine: PFAEmitEngine =>
    def emit(x) = outputDataStream.append(x)
    emitEngine.emit = emit
    emitEngine.begin()
    while (inputDataStream.hasNext)
      emitEngine.action(inputDataStream.next())
    emitEngine.end()

  case otherEngine =>
    otherEngine.begin()
    while (inputDataStream.hasNext)
      outputDataStream.append(otherEngine.action(inputDataStream.next()))
    otherEngine.end()
}
outputDataStream.close()

Take a snapshot of a changing model and write it as a new PFA file.

val snapshotFile = new java.io.FileOutputStream("snapshot.pfa")
snapshotFile.write(engine.snapshot.toJson(lineNumbers = false))
snapshotFile.close()

Take a snapshot of just one cell and write it as a JSON fragment.

import com.opendatagroup.hadrian.data.toJson
val myCellFile = new java.io.FileOutputStream("myCell.json")
myCellFile.write(toJson(engine.snapshotCell("myCell"), engine.config.cells("myCell").avroType))
myCellFile.close()

Calling a PFA user-defined function from an external agent.

// get the callable function object
val myFunction = engine.fcn2("myFunction")

// verify that the arguments are what we think they are
import com.opendatagroup.hadrian.datatype._
assert(engine.config.fcns("myFunction").params, Seq("x" -> AvroDouble(), "y" -> AvroString()))

// call it with some arguments
myFunction(java.lang.Double.valueOf(3.14), "hello")

Specialized data:

Data passed to action, fcn* or accepted from action, fcn*, analyzeCell, analyzePool, snapshotCell, snapshotPool has to satisfy a particular form. That form is:

Compiled types, namely enum, fixed, and record, have to be converted using fromPFAData or fromGenericAvroData.

Although all of these types are immutable in PFA, bytes, fixed, and record are mutable in Java, but if you modify them, the behavior of the PFA engine is undefined and likely to be wrong. Do not change these objects in place!

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. PFAEngine
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def action(input: INPUT): OUTPUT

    Entry point for computing one datum: call this after begin.

    Entry point for computing one datum: call this after begin.

    input

    datum to compute; objects must be specialized to this class (see above).

    returns

    if method is map, returns the transformed input; if method is emit, returns null (provide a user-defined emit callback to capture results!); if method is fold, returns the current cumulative tally.

  2. abstract def analyzeCell[X](name: String, analysis: (Any) ⇒ X): X

    Perform an analysis of a cell using a user-defined function.

    Perform an analysis of a cell using a user-defined function.

    name

    the name of the cell

    analysis

    a function to perform some analysis of the cell to which it is applied; note that this function must not change the cell's state

    returns

    whatever analysis returns

    Note that the analysis function is called exactly once.

  3. abstract def analyzePool[X](name: String, analysis: (Any) ⇒ X): Map[String, X]

    Perform an analysis of a pool using a user-defined function.

    Perform an analysis of a pool using a user-defined function.

    name

    the name of the pool

    analysis

    a function to perform some analysis of each item in the pool; note that this function must not change the pool's state

    returns

    a map from pool item name to whatever analysis returns for that pool item

    Note that the analysis function is called as many times as there are items in the pool.

  4. abstract def avroInputIterator[X](inputStream: InputStream): DataFileStream[X]

    Create an Avro iterator (subclass of java.util.Iterator) over Avro-serialized input data.

    Create an Avro iterator (subclass of java.util.Iterator) over Avro-serialized input data.

    The objects produced by this iterator are suitable inputs to the action method.

    inputStream

    serialized data

    returns

    unserialized data

  5. abstract def avroOutputDataStream(file: File): AvroOutputDataStream

    Create an output stream for Avro-serializing scoring engine output.

    Create an output stream for Avro-serializing scoring engine output.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    file

    a file that will be overwritten by output.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  6. abstract def avroOutputDataStream(outputStream: OutputStream): AvroOutputDataStream

    Create an output stream for Avro-serializing scoring engine output.

    Create an output stream for Avro-serializing scoring engine output.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    outputStream

    the raw output stream onto which Avro bytes will be written.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  7. abstract def begin(): Unit

    Entry point for starting up a scoring engine: call this first.

  8. abstract def callDepth(fcnName: String, exclude: Set[String] = Set[String](), startingDepth: Double = 0): Double

    Determine call depth of a function by traversing the callGraph.

    Determine call depth of a function by traversing the callGraph.

    fcnName

    name of function to look up

    exclude

    set of functions to exclude

    startingDepth

    used by recursion to count

    returns

    integral number representing call depth as a Double, with positive infinity as a possible result

  9. abstract def callGraph: Map[String, Set[String]]

    Graph of which functions can call which other functions in the engine.

    Graph of which functions can call which other functions in the engine.

    Map from function name (special forms in parentheses) to the set of all functions it calls. This map can be traversed as a graph by repeated application.

  10. abstract def calledBy(fcnName: String, exclude: Set[String] = Set[String]()): Set[String]

    Determine which functions are called by fcnName by traversing the callGraph backward.

    Determine which functions are called by fcnName by traversing the callGraph backward.

    fcnName

    name of function to look up

    exclude

    set of functions to exclude

    returns

    set of functions that can call fcnName

  11. abstract def classLoader: ClassLoader

    ClassLoader in which this scoring engine and its compiled types are compiled.

  12. abstract def config: EngineConfig

    Abstract syntax tree that was used to generate this engine.

  13. abstract def csvInputIterator[X](inputStream: InputStream, csvFormat: CSVFormat = CSVFormat.DEFAULT.withHeader()): Iterator[X]

    Create an iterator over CSV-serialized input data.

    Create an iterator over CSV-serialized input data.

    The objects produced by this iterator are suitable inputs to the action method.

    Note that only records of primitives can be read from CSV because of the nature of the CSV format.

    inputStream

    serialized data

    csvFormat

    format description for Apache commons-csv

    returns

    unserialized data

  14. abstract def csvOutputDataStream(outputStream: OutputStream, csvFormat: CSVFormat = ..., writeHeader: Boolean = true): CsvOutputDataStream

    Create an output stream for CSV-serializing scoring engine output.

    Create an output stream for CSV-serializing scoring engine output.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    Note that only records of primitives can be written to CSV because of the nature of the CSV format.

    outputStream

    the raw output stream onto which CSV bytes will be written.

    csvFormat

    format description for Apache commons-csv

    writeHeader

    if true, write field names as the first line of the file.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  15. abstract def datumReader: DatumReader[INPUT]

    Specialized Avro data reader for this PFAEngine.

    Specialized Avro data reader for this PFAEngine.

    Reads Avro streams into objects this engine can use (see the *Input, *InputIterator methods to prepare input objects).

  16. abstract def end(): Unit

    Entry point for ending a scoring engine: call this after all action calls are complete.

    Entry point for ending a scoring engine: call this after all action calls are complete.

    If the input data stream is infinite, such a time may never happen.

  17. abstract def fcn0(name: String): () ⇒ AnyRef

    Get a 0-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 0-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  18. abstract def fcn1(name: String): (AnyRef) ⇒ AnyRef

    Get a 1-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 1-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  19. abstract def fcn10(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 10-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 10-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  20. abstract def fcn11(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 11-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 11-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  21. abstract def fcn12(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 12-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 12-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  22. abstract def fcn13(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 13-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 13-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  23. abstract def fcn14(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 14-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 14-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  24. abstract def fcn15(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 15-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 15-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  25. abstract def fcn16(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 16-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 16-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  26. abstract def fcn17(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 17-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 17-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  27. abstract def fcn18(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 18-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 18-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  28. abstract def fcn19(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 19-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 19-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  29. abstract def fcn2(name: String): (AnyRef, AnyRef) ⇒ AnyRef

    Get a 2-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 2-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  30. abstract def fcn20(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 20-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 20-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  31. abstract def fcn21(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 21-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 21-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  32. abstract def fcn22(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 22-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 22-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  33. abstract def fcn3(name: String): (AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 3-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 3-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  34. abstract def fcn4(name: String): (AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 4-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 4-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  35. abstract def fcn5(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 5-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 5-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  36. abstract def fcn6(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 6-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 6-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  37. abstract def fcn7(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 7-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 7-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  38. abstract def fcn8(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 8-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 8-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  39. abstract def fcn9(name: String): (AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef, AnyRef) ⇒ AnyRef

    Get a 9-parameter user-defined function from the scoring engine as something that can be executed by an external agent.

    Get a 9-parameter user-defined function from the scoring engine as something that can be executed by an external agent. If the PFA did not declare a user-defined function with this name or it has a different number of parameters, this will throw a java.util.NoSuchElementException.

  40. abstract def fromGenericAvroData(datum: AnyRef): INPUT

    Translate data that might have been deserialized by Avro into objects suitable for this PFAEngine's action.

    Translate data that might have been deserialized by Avro into objects suitable for this PFAEngine's action.

    datum

    objects that may be Avro generic or Avro specific objects (note that Avro specific objects are subclasses of Avro generic objects)

    returns

    objects that can be input for this PFAEngine's action.

  41. abstract def fromPFAData(datum: AnyRef): INPUT

    Translate data that might have come from any PFAEngine class (not necessarily this one) into objects suitable for this PFAEngine's action.

    Translate data that might have come from any PFAEngine class (not necessarily this one) into objects suitable for this PFAEngine's action.

    datum

    objects that may have been output from another type of PFAEngine's action, snapshotCell, or snapshotPool.

    returns

    objects that can be input for this PFAEngine's action.

  42. abstract def hasRecursive(fcnName: String): Boolean

    Determine if the call depth of a function is infinite.

    Determine if the call depth of a function is infinite.

    fcnName

    name of function to check

    returns

    true if the function can eventually call itself through a function that it calls, false otherwise

  43. abstract def hasSideEffects(fcnName: String): Boolean

    Determine if a function modifies the scoring engine's persistent state.

    Determine if a function modifies the scoring engine's persistent state.

    fcnName

    name of function to check

    returns

    true if the function can eventually call (cell-to) or (pool-to) on any cell or pool.

  44. abstract def inputClass: Class[AnyRef]

    Class object for the input type.

  45. abstract def inputType: AvroType

    Get the AvroType of the input.

  46. abstract def instance: Int

    Instance number, non-zero if this engine is part of a collection of scoring engines made from the same PFA file.

  47. abstract def isRecursive(fcnName: String): Boolean

    Determine if a function is directly recursive.

    Determine if a function is directly recursive.

    fcnName

    name of function to check

    returns

    true if the function directly calls itself, false otherwise

  48. abstract def jsonInput(json: String): INPUT

    Deserialize one JSON datum as suitable input to the action method.

  49. abstract def jsonInput(json: Array[Byte]): INPUT

    Deserialize one JSON datum as suitable input to the action method.

  50. abstract def jsonInputIterator[X](inputIterator: Iterator[String]): Iterator[X]

    Create an iterator over JSON-serialized input data.

    Create an iterator over JSON-serialized input data.

    The objects produced by this iterator are suitable inputs to the action method.

    inputIterator

    serialized data

    returns

    unserialized data

  51. abstract def jsonInputIterator[X](inputIterator: Iterator[String]): Iterator[X]

    Create an iterator over JSON-serialized input data.

    Create an iterator over JSON-serialized input data.

    The objects produced by this iterator are suitable inputs to the action method.

    inputIterator

    serialized data

    returns

    unserialized data

  52. abstract def jsonInputIterator[X](inputStream: InputStream): Iterator[X]

    Create an iterator over JSON-serialized input data.

    Create an iterator over JSON-serialized input data.

    The objects produced by this iterator are suitable inputs to the action method.

    inputStream

    serialized data

    returns

    unserialized data

  53. abstract def jsonOutput(obj: OUTPUT): String

    Serialize one datum from the action method as JSON.

  54. abstract def jsonOutputDataStream(fileName: String, writeSchema: Boolean): JsonOutputDataStream

    Create an output stream for JSON-serializing scoring engine output.

    Create an output stream for JSON-serializing scoring engine output.

    Writes one JSON object per line.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    fileName

    the name of a file that will be overwritten by output.

    writeSchema

    if true, write an Avro schema as the first line of the file for interpreting the JSON objects.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  55. abstract def jsonOutputDataStream(file: File, writeSchema: Boolean): JsonOutputDataStream

    Create an output stream for JSON-serializing scoring engine output.

    Create an output stream for JSON-serializing scoring engine output.

    Writes one JSON object per line.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    file

    a file that will be overwritten by output.

    writeSchema

    if true, write an Avro schema as the first line of the file for interpreting the JSON objects.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  56. abstract def jsonOutputDataStream(outputStream: OutputStream, writeSchema: Boolean): JsonOutputDataStream

    Create an output stream for JSON-serializing scoring engine output.

    Create an output stream for JSON-serializing scoring engine output.

    Writes one JSON object per line.

    Return values from the action method (or outputs captured by an emit callback) are suitable for writing to this stream.

    outputStream

    the raw output stream onto which JSON bytes will be written.

    writeSchema

    if true, write an Avro schema as the first line of the file for interpreting the JSON objects.

    returns

    an output stream with an append method for appending output data objects and a close method for flushing the buffer and closing the stream.

  57. abstract val log: (String, Option[String]) ⇒ Unit

    Externally supplied function for handling log output from PFA.

    Externally supplied function for handling log output from PFA.

    By default, prints to standard out.

    Arguments:

    • String to write to log
    • Some(namespace) for filtering log messages or None
  58. abstract def method: Method

    Report whether this is a PFAMapEngine, PFAEmitEngine, or a PFAFoldEngine.

    Report whether this is a PFAMapEngine, PFAEmitEngine, or a PFAFoldEngine.

    Note that this information is also available in config.method.

  59. abstract def namedTypes: Map[String, AvroCompiled]

    Get the AvroType of each compiled type.

  60. abstract def options: EngineOptions

    Implementation-specific configuration options.

  61. abstract def outputClass: Class[AnyRef]

    Class object for the output type.

  62. abstract def outputType: AvroType

    Get the AvroType of the output.

  63. abstract def randomGenerator: Random

    The random number generator used by this particular scoring engine instance.

    The random number generator used by this particular scoring engine instance.

    Note that if a randseed is given in the PFA file but a collection of scoring engines are generated from it, each scoring engine instance will have a different random generator seeded by a different seed.

  64. abstract def revert(sharedState: Option[SharedState]): Unit

    Restore this scoring engine's original state as defined by the PFA file and sharedState object it was derived from.

    Restore this scoring engine's original state as defined by the PFA file and sharedState object it was derived from.

    sharedState

    same as the sharedState passed to fromJson, fromAst, factoryFromJson, etc.

  65. abstract def revert(): Unit

    Restore this scoring engine's original state as defined by the PFA file it was derived from.

  66. abstract def snapshot: EngineConfig

    Take a snapshot of the entire scoring engine (all cells and pools) and represent it as an abstract syntax tree that can be used to make new scoring engines.

    Take a snapshot of the entire scoring engine (all cells and pools) and represent it as an abstract syntax tree that can be used to make new scoring engines.

    Note that you can call toJson on the EngineConfig to get a string that can be written to a PFA file.

  67. abstract def snapshotCell(name: String): AnyRef

    Take a snapshot of one cell and represent it using objects specialized to this class (see above).

    Take a snapshot of one cell and represent it using objects specialized to this class (see above).

    name

    the name of the cell

    returns

    an object that may contain internal PFA data, such as instances of classes that are only found in this engine's custom classLoader.

  68. abstract def snapshotPool(name: String): Map[String, AnyRef]

    Take a snapshot of one pool and represent it using objects specialized to this class (see above).

    Take a snapshot of one pool and represent it using objects specialized to this class (see above).

    name

    the name of the pool

    returns

    a Map from pool item name to objects that may contain internal PFA data, such as instances of classes that are only found in this engine's custom classLoader.

  69. abstract def specificData: PFASpecificData

    Specialized Avro data model for this PFAEngine.

    Specialized Avro data model for this PFAEngine.

    Deserializes Avro data into objects this engine can use (see the *Input, *InputIterator methods to prepare input objects).

  70. abstract def typeParser: ForwardDeclarationParser

    The parser used to interpret Avro types in the PFA document, which may be used to find compiled types used by this engine.

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  18. def toString(): String

    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped