For DAG-based plots, allow conditionally skipping a plot
With large plot configurations, one inevitably gets at a point where some plot configurations only work for specific input data. While these plots typically simply fail and (if not in debug mode) the other plots are continued on, it would be nice to conditionally skip some plots where it is clear that they will not work.
Proposal
As DAG-based plots compute all relevant data prior to plot function invocation, these are the perfect place to implement such a feature.
- Declare a plot function parameter, e.g.
skip_if
, which denotes which DAG tag should be inspected to decide whether to skip a plot or not - In
BasePlotCreator
, make sure that the computation of that tag is invoked first, separately from the actual DAG results - If a plot is to be skipped, raise a custom
SkipThisPlot
exception. - Let the
PlotManager
handle that exception, show the appropriate logging message, and continue with the other plots. - This should also work for parameter-space plot configurations, where individual plots are skipped
- For skipping all plots of a parameter sweep plot config (to avoid redundant checks), a separate option would be needed ...
Interface example
my_plot:
select:
data: path/to/data
transform:
- .ndim: !dag_tag data
# The following defines a DAG tag that evaluates to true when the data is _not_ 2-dimensional
- !=: [!dag_prev , 2]
tag: data_is_not_2d
skip_if: data_is_not_2d