Profile Reader Component

Profile Reader component is responsible for reading Insights Profile and returning the deserialized Profile. It can read from local file system and OCI Object Storage locations. Users typically use Profile Reader to load a Reference/Baseline Profile when doing a Prediction run or when executing Insights Tests. This component can be configured using both Insights Builder API and Insights Configuration API.

Profile Reader Type

Description

LocalProfileReader

Reads Insights Profile from the local file system.

OCIObjectStorageProfileReader

Reads Insights Profile from user-provided OCI Object Storage bucket.

LocalProfileReader

Use this Profile Reader to read profiles from local file system.

Configuration:
  • path : The path to the profile stored in local file system

    path = {'/location/profiles/profile.bin'}
    

Below is an example of using this reader:

from mlm_insights.core.profile_readers.local_profile_reader import LocalProfileReader
local_profile_reader = LocalProfileReader(path="/location/profiles/profile.bin")
profile_reader_result =  local_profile_reader.read()
# The LocalProfileReader.read() method returns a ProfileReaderResult object, which contains the profile.
profile = profile_reader_result.profile

OCIObjectStorageProfileReader

Use this Profile Reader to read profiles from OCI Object Storage bucket.

Configuration:
  • path : The path to the profile stored in OCI Object Storage. Must be of the form oci://<location_of_file>

    path = {'oci://<location_of_file>'}
    
  • storage_options: A dictionary containing optional configuration options for OCI Object Storage.Typically, this dictionary should contain OCI region and signer details.

    storage_options = {"region": region, "signer": signer}
    

Below is an example of using this reader:

from mlm_insights.core.profile_readers.oci_object_storage_profile_reader import OCIObjectStorageProfileReader
oci_object_storage_profile_reader = OCIObjectStorageProfileReader(path="oci://location/profiles/profile.bin")
profile_reader_result =  oci_object_storage_profile_reader.read()
# The OCIObjectStorageProfileReader.read() method returns a ProfileReaderResult object, which contains the profile.
profile = profile_reader_result.profile

Note

  1. Users can write their own Profile Readers based on their specific requirements. To do so, write a class derived from ProfileReader interface and implement read method