def METHOD_NAME(
    *,
    on_init: Optional[Union[BaseNode, str]] = None,
    on_finalize: Optional[Union[BaseNode, str]] = None,
) -> None:
    """Set pipeline settings for current `dsl.pipeline` definition.
    This function should be called inside a `dsl.pipeline` decorated function, otherwise will raise exception.
    :keyword on_init: On_init job node or name. On init job will be executed before all other jobs, \
                it should not have data connections to regular nodes.
    :paramtype on_init: Union[BaseNode, str]
    :keyword on_finalize: On_finalize job node or name. On finalize job will be executed after pipeline run \
                finishes (completed/failed/canceled), it should not have data connections to regular nodes.
    :paramtype on_finalize: Union[BaseNode, str]
    :return:
    """
    dsl_settings = _dsl_settings_stack.top()
    if on_init is not None:
        dsl_settings.init_job = on_init
    if on_finalize is not None:
        dsl_settings.finalize_job = on_finalize