New Product Comparison Plugin (--compare)#
For the purposes of this tutorial, I will assume you are creating a new
Plugin microscope for comparing Products. Before
beginning:
See Stage 5 Inter-Batch Dataflow to get a brief overview of how data flows through the pipeline w.r.t. stage 5,
See Plugin Development Guide for a general overview of creating a new plugin.
Determine the type(s) of comparison your plugin will support: comparing across controllers, across scenarios, and across batch criteria. This is driven by the --across stage 5 option common to all stage 5 plugins.
To begin, create the following filesystem structure in
$HOME/git/plugins/microscope.
plugin.py- This file is required, and is where most of the bits for the plugin will go. You don't have to call it this; if you want to use a different name, see Schemas for options.cmdline.pyThis file is optional. If your new plugin doesn't need any additional cmdline arguments, you can skip it.
These files will be populated as you go through the rest of the tutorial.
Create additional cmdline arguments for the new engine by following Extending the SIERRA Cmdline For Your Plugin.
Create the following filesystem structure in
$HOME/git/plugins/microscope:Within this file, you must define the following functions, which must be named EXACTLY as specified, otherwise SIERRA will not detect them.
from sierra.core import types, batchroot import sierra.core.variables.batch_criteria as bc def proc_exps( main_config: types.YAMLDict, cmdopts: types.Cmdopts, cli_args: argparse.Namespace, ) -> None: """Compare products across batch experiments. Can be serially or in parallel; should respect ``--processing-parallelism``. See :class:`~sierra.plugins.compare.comparator.BaseComparator` for some reusable scaffolding. """
Put
$HOME/git/pluginson yourSIERRA_PLUGIN_PATH. Then your plugin can be selected as--compare=plugins.microscope.