Post Processor Component

Post processor components are responsible for running any action after the entire data is processed and all the metrics are calculated. They can be used for different purposes, like writing the metric result to storage, calling any external service, or integration with other tools. The interface of the post processor is intentionally kept open ended for the same reason.

Post processor components only have access to the final output of the framework, for example, the profile, and don’t have access to any of the input data. You can add many post processor components to your monitoring runs for the builder and they are all be run.

is_critical flag can be passed to a post processor. When set to true, Insights run is marked as failed when the post processor execution fails. By default the flag is set to False.

How to use

In this section we see how can to set up the post processor to be used with ML Insights. Import a simple post processor that writes the profile output as a binary file to local storage. An optional parameter of is_critical can be set to True which can mark the insights run as fail in case of failure in post processor run. This flag is false by default.

  1. Import all the relevant post processor classes to use
    from mlm_insights.core.post_processors.local_writer_post_processor import LocalWriterPostProcessor
    
  2. Construct a new object by passing the right parameters (if any) to the constructor and create a list
    post_processor_list = [LocalWriterPostProcessor(file_location="profiles", file_name="profile.bin", is_critical=True)]
    
  3. Pass the newly created list to builder object
    InsightsBuilder().with_post_processors(post_processors=post_processor_list)