Source code for pipeline.h.cli.h_save

##################### generated by xml-casa (v2) from h_save.xml ####################
##################### 721a1fd06826cd6f42da993fce2f5433 ##############################
from __future__ import absolute_import
import numpy
from casatools.typecheck import CasaValidator as _val_ctor
_pc = _val_ctor( )
from casatools.coercetype import coerce as _coerce
from .private.task_h_save import h_save as _h_save_t
from casatasks.private.task_logging import start_log as _start_log
from casatasks.private.task_logging import end_log as _end_log

class _h_save:
    """
    h_save ---- Save the pipeline state to disk

    h_save saves the current pipeline state to disk using a unique filename.
    If no name is supplied one is generated automatically from a combination
    of the root name, 'context', the current stage number, and a time stamp.

    --------- parameter descriptions ---------------------------------------------

    filename Name of the saved pipeline state. If filename is '' then
             a unique name will be generated computed several components: the
             root, 'context', the current stage number, and the time stamp.

    --------- examples -----------------------------------------------------------

    
    1. Save the current state in the default file
    
    h_save()
    
    2. Save the current state to a file called 'savestate_1'
    
    h_save(filename='savestate_1')


    """

    _info_group_ = """pipeline"""
    _info_desc_ = """Save the pipeline state to disk"""

    def __call__( self, filename='' ):
        schema = {'filename': {'type': 'cStr', 'coerce': _coerce.to_str}}
        doc = {'filename': filename}
        assert _pc.validate(doc,schema), str(_pc.errors)
        _logging_state_ = _start_log( 'h_save', [ 'filename=' + repr(_pc.document['filename']) ] )
        return _end_log( _logging_state_, 'h_save', _h_save_t( _pc.document['filename'] ) )

h_save = _h_save( )