Source code for pipeline.h.cli.h_init
from typing import Any
import pipeline.infrastructure.basetask as basetask
import pipeline.infrastructure.launcher as launcher
from . import cli, utils
[docs]
@utils.cli_wrapper
def h_init(
loglevel: str = 'info',
plotlevel: str = 'default',
weblog: bool = True,
processing_intents: dict[str, Any] | None = None,
) -> launcher.Context:
"""Initialize the pipeline state and context.
:py:func:`h_init <h_init>` must be called before any other pipeline task. The pipeline
can be initialized in one of two ways: by creating a new pipeline
state (:py:func:`h_init <h_init>`) or be loading a saved pipeline state (:py:func:`h_resume <h_resume>`).
:py:func:`h_init <h_init>` creates an empty pipeline context but does not load visibility data
into the context. Any of the pipeline `h*_importdata` tasks can be used to load data.
Args:
loglevel: Log level for pipeline messages. Log messages below this threshold will not be displayed.
plotlevel: Toggle generation of detail plots in the web log. A level of 'all' generates all plots;
'summary' omits detail plots; 'default' generates all plots apart from for the hif_applycal task.
weblog: Generate the web log
processing_intents: Dictionary of processing intents for the current pipeline run.
Examples:
1. Create the pipeline context
>>> h_init()
"""
# Create the pipeline and store the Pipeline object in the stack
pipeline = launcher.Pipeline(loglevel=loglevel, plotlevel=plotlevel, processing_intents=processing_intents)
cli.stack[cli.PIPELINE_NAME] = pipeline
basetask.DISABLE_WEBLOG = not weblog
return pipeline.context