How to use the pypyr.errors.Stop function in pypyr

To help you get started, we’ve selected a few pypyr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pypyr / pypyr-cli / pypyr / errors.py View on Github external
class PlugInError(Error):
    """Pypyr plug - ins should sub - class this."""


class PyModuleNotFoundError(Error, ModuleNotFoundError):
    """Could not load python module because it wasn't found."""


# -------------------------- Control of Flow Instructions ---------------------
class Stop(Error):
    """Control of flow. Stop all execution."""


class StopPipeline(Stop):
    """Control of flow. Stop current pipeline execution."""


class StopStepGroup(Stop):
    """Control of flow. Stop current step - group execution."""


class ControlOfFlowInstruction(Error):
    """Control of flow instructions should inherit from this.

    Attributes:
        groups: list of str. List of step - groups to execute.
        success_group: str. Step - group to execute on success condition.
        failure_group: str. Step - group to execute on failure condition.
    """
github pypyr / pypyr-cli / pypyr / errors.py View on Github external
class PyModuleNotFoundError(Error, ModuleNotFoundError):
    """Could not load python module because it wasn't found."""


# -------------------------- Control of Flow Instructions ---------------------
class Stop(Error):
    """Control of flow. Stop all execution."""


class StopPipeline(Stop):
    """Control of flow. Stop current pipeline execution."""


class StopStepGroup(Stop):
    """Control of flow. Stop current step - group execution."""


class ControlOfFlowInstruction(Error):
    """Control of flow instructions should inherit from this.

    Attributes:
        groups: list of str. List of step - groups to execute.
        success_group: str. Step - group to execute on success condition.
        failure_group: str. Step - group to execute on failure condition.
    """

    def __init__(self, groups, success_group, failure_group):
        """Initialize the control of flow instruction.

        Args:
github pypyr / pypyr-cli / pypyr / pipelinerunner.py View on Github external
pypyr.log.logger.set_root_logger(log_level, log_path)

    logger.debug("starting pypyr")

    # pipelines specify steps in python modules that load dynamically.
    # make it easy for the operator so that the cwd is automatically included
    # without needing to pip install a package 1st.
    pypyr.moduleloader.set_working_directory(working_dir)

    try:
        load_and_run_pipeline(pipeline_name=pipeline_name,
                              pipeline_context_input=pipeline_context_input,
                              groups=groups,
                              success_group=success_group,
                              failure_group=failure_group)
    except Stop:
        logger.debug("Stop: stopped pypyr")

    logger.debug("pypyr done")