Class OutputManager


public class OutputManager extends AnchorBean<OutputManager>
Responsible for making decisions on where output goes and what form it takes.

An output prefix (with directory and/or file-path components) is calculated for each input.

Rules can be specified in outputsEnabled as to which outputs occur or do not occur (from the available outputs in an experiment) when an experiment is run.

  • Constructor Details

    • OutputManager

      public OutputManager()
  • Method Details

    • determineEnabledOutputs

      public MultiLevelOutputEnabled determineEnabledOutputs(RecordedOutputsWithRules recordedOutputs)
      Determines which outputs are enabled or not.
      Parameters:
      recordedOutputs - where output-names are recorded as used/tested.
      Returns:
      a MultiLevelOutputEnabled which indicates which outputs are enabled or not.
    • createContextForWriting

      public OutputWriteContext createContextForWriting(Optional<ImageFileFormat> suggestedFormatToWrite, ExecutionTimeRecorder executionTimeRecorder)
      Creates the OutputWriteContext needed for writing files.
      Parameters:
      suggestedFormatToWrite - a suggestion on what file-format to write.
      executionTimeRecorder - for recording the execution-times of operations.
      Returns:
      newly created context.
    • createExperimentOutputter

      public OutputterChecked createExperimentOutputter(Optional<String> experimentIdentifier, MultiLevelOutputEnabled outputsEnabled, Optional<MultiLevelRecordedOutputs> recordedOutputs, OutputWriteContext writeContext, PathPrefixerContext prefixerContext, Optional<Consumer<Path>> callUponDirectoryCreation, Optional<Logger> logger) throws BindFailedException
      Creates an outputter for the experiment in general.

      i.e. this is not an outputter for a specific job.

      Parameters:
      experimentIdentifier - if defined, an identifier for the experiment, to be included in the directory root.
      outputsEnabled - which outputs are enabled. This is typically provided via a call to determineEnabledOutputs(RecordedOutputsWithRules).
      recordedOutputs - if defined, remembers which outputs are written or not.
      writeContext - context needed for writing. This is typically provided via a call to createContextForWriting(Optional, ExecutionTimeRecorder).
      prefixerContext - parameters for the file-path prefixer.
      callUponDirectoryCreation - when defined, this consumer is called (with the directory path) when the directory is first created, as it is created lazily only when first needed.
      logger - logger for warning for information messages when outputting.
      Returns:
      a newly created outputter.
      Throws:
      BindFailedException - when an outputter cannot be successfully bound to an output directory.
    • getPrefixer

      public PathPrefixer getPrefixer()
      Determines a prefix to use when outputting a file based upon an input-path.

      This method is called with a binding path from the input to determine a output prefix for each input to an experiment.

    • setPrefixer

      public void setPrefixer(PathPrefixer prefixer)
      Determines a prefix to use when outputting a file based upon an input-path.

      This method is called with a binding path from the input to determine a output prefix for each input to an experiment.

    • isSilentlyDeleteExisting

      public boolean isSilentlyDeleteExisting()
      Whether to silently first delete any existing output at the intended path, or rather throw an error.

      If true, if an existing output folder (at intended path) is deleted If false, an error is thrown if the folder already exists

    • setSilentlyDeleteExisting

      public void setSilentlyDeleteExisting(boolean silentlyDeleteExisting)
      Whether to silently first delete any existing output at the intended path, or rather throw an error.

      If true, if an existing output folder (at intended path) is deleted If false, an error is thrown if the folder already exists

    • getOutputWriteSettings

      public OutputWriteSettings getOutputWriteSettings()
      General settings (default file extensions, colors etc.) for outputting files.
    • setOutputWriteSettings

      public void setOutputWriteSettings(OutputWriteSettings outputWriteSettings)
      General settings (default file extensions, colors etc.) for outputting files.
    • getOutputsEnabled

      public OutputEnabledRules getOutputsEnabled()
      Which outputs are enabled or not enabled. If null, default rules are used instead.
    • setOutputsEnabled

      public void setOutputsEnabled(OutputEnabledRules outputsEnabled)
      Which outputs are enabled or not enabled. If null, default rules are used instead.