Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Metrics jobs are, for the most part, just regular batch jobs. The main difference is that all the input records are supplied at the same time to the action function. So while the action function for a normal scoring batch job can be expected to be called once for each input record, the action function for a metrics job can be expected to be called only once.

JSON Input

For JSON-based input data for the Metrics function, the ModelOp Runtime supports two structures:

1. JSON Lines

The JSON lines (i.e. jsonl) structure is allowed by the ModelOp Runtime when there are multiple json records in a single file. This structure requires a carriage return between each record.

A simple example:

Code Block
languagejson
{"asdf"}
{"qwer"}

2. Array of JSON Records

Additionally, the ModelOp runtime supports an array of json records when there are multiple json records in a single file. This structure requires the standard [] json array notation, with commas separating each record.

A simple example:

Code Block
languagejson
[{"asdf"}, {"qwer"}]

This includes support for when records are broken up across multiple lines:

Code Block
languagejson
[
  {"asdf"},
  {"qwer"}
]

Notes:

  • A file with a single line that contains a json object that is a list is assumed to contain multiple records - i.e. each element of the list is a record.

  • A file with a single line that contains a json object that is NOT a list is assumed to contain a single record.

  • This is all detected at runtime as the .json file is read in. In cases where it is determined that what is passed in was a single array with multiple records, a new bit o' log output will show up in the logs:

Code Block
[info] json autodetected to be a single array of containing multiple records

Automatically Importing Requirements into a ModelOp Runtime

...