# -*- coding: utf-8 -*-
"""
Sup3r data pipeline architecture.
"""
import logging

from reV.pipeline.pipeline import Pipeline
from rex.utilities.loggers import init_logger

from sup3r.pipeline.config import Sup3rPipelineConfig

logger = logging.getLogger(__name__)


class Sup3rPipeline(Pipeline):
    """NSRDB pipeline execution framework."""

    CMD_BASE = 'python -m sup3r.cli config -c {fp_config} -cmd {command}'

    COMMANDS = ('preprocessing')

    def __init__(self, pipeline, monitor=True, verbose=False):
        """
        Parameters
        ----------
        pipeline : str | dict
            Pipeline config file path or dictionary.
        monitor : bool
            Flag to perform continuous monitoring of the pipeline.
        verbose : bool
            Flag to submit pipeline steps with -v flag for debug logging
        """
        self.monitor = monitor
        self.verbose = verbose
        self._config = Sup3rPipelineConfig(pipeline)
        self._run_list = self._config.pipeline
        self._init_status()

        # init logger for pipeline module if requested in input config
        if 'logging' in self._config:
            init_logger('sup3r.pipeline', **self._config.logging)
            init_logger('reV.pipeline', **self._config.logging)
