Config Writer Component

Config Writer provides a set of methods to create a config JSON file from builder object. By providing optional parameters of monitor id and storage details, user can generate the config JSON needed to run ml-monitoring application. This config can be saved to object storage. This component aids the user in authoring configs for both mlm-insights library and ml-monitoring application and guarantee configs have components in correct parameters and values.

How to use it

Below, we have described the steps the user needs to take to create their config JSON from a builder object.

  • Use InsightsBuilder API to build all the relevant Insights components.

  • Use InsightsConfigWriter API to construct the Insights/ML Monitoring Application JSON

  • Use InsightsConfigWriter API to persist the monitor config to OCI Object Storage

config_writer = InsightsConfigWriter(insights_builder=insights_builder)
config_writer.to_json()

By passing the monitor_id and storage_details, user can generate the config json required to run the ml-monitoring application.

Monitor Id is a user provided id used to identify a monitor config uniquely. Below are the rules to define a monitor_id.

  • The length should be minimum 8 characters and maximum 48 characters.

  • Valid characters are letters (upper or lowercase), numbers, hyphens, underscores, and periods.

Description

Key

Value

Example

monitor_id

user defined string

“monitor_id”: “speech_model_monitor”

Example

{"monitor_id": "speech_model_monitor"}

Storage details is details of the type of storage and location for retrieving the baseline profile(in case of a prediction run) and persist the internal state of a run.

Description

Field Name

Description

Example

storage_type

type of storage to be used for storing the internal state

“storage_type”: “OciObjectStorage”

param

params (required)

“params”: {

“namespace”: “<namespace>”, “bucket_name”: “<bucket_name>”, “object_prefix”: “<prefix>”

}

Supported Storage Details

  • OciObjectStorage

    Required Parameters
    • namespace - namespace of the bucket

    • bucket_name - bucket name

    Optional Parameters
    • object_prefix - prefix for creating the directory for saving the internal state of the runs

Example

storage_details
"storage_details": {
        "storage_type": "OciObjectStorage",
        "params": {
          "namespace": "<namespace>",
          "bucket_name": "<bucket_name>",
          "object_prefix": "<object_prefix>"
        }
  }
config_writer = InsightsConfigWriter(insights_builder=insights_builder, monitor_id=monitor_id, storage_details=storage_details)
config_writer.to_json()

Saving Config to Object Storage

User can save the config created from builder object into object storage. Bucket name, namespace and location of the config in object storage needs to be provided to save the config in object storage. User can optionally provide storage options as a dictionary to provide security credentials to authenticate.

save_config_to_object_storage(self,bucket_name: str, config_location: str, namespace: str,
             storage_options: Dict[str, Any] = {})