(**kwargs)
\b
        - DESCRIPTION:
            Pipeline Config Command. User can choose to provide path to conf file,
            or provide ip address and http port of a valid fate flow server. Optionally,
            pipeline log directory can be set to arbitrary location. Default log directory is
            pipeline/logs. Notice that, if both conf file and specifications are provided,
            settings in conf file are ignored.

        \b
        - USAGE:
            pipeline init -c config.yaml
            pipeline init --ip 10.1.2.3 --port 9380 --log-directory ./logs --system-user guest
\b
        - DESCRIPTION:
            Pipeline Config Command. User can choose to provide path to conf file,
            or provide ip address and http port of a valid fate flow server. Optionally,
            pipeline log directory can be set to arbitrary location. Default log directory is
            pipeline/logs. Notice that, if both conf file and specifications are provided,
            settings in conf file are ignored.
\ b - DESCRIPTION : Pipeline Config Command . User can choose to provide path to conf file or provide ip address and http port of a valid fate flow server . Optionally pipeline log directory can be set to arbitrary location . Default log directory is pipeline / logs . Notice that if both conf file and specifications are provided settings in conf file are ignored .
def _init(**kwargs):
    """
        \b
        - DESCRIPTION:
            Pipeline Config Command. User can choose to provide path to conf file,
            or provide ip address and http port of a valid fate flow server. Optionally,
            pipeline log directory can be set to arbitrary location. Default log directory is
            pipeline/logs. Notice that, if both conf file and specifications are provided,
            settings in conf file are ignored.

        \b
        - USAGE:
            pipeline init -c config.yaml
            pipeline init --ip 10.1.2.3 --port 9380 --log-directory ./logs --system-user guest
    """
    config_path = kwargs.get("config_path")
    ip = kwargs.get("ip")
    port = kwargs.get("port")
    log_directory = kwargs.get("log_directory")
    system_user = kwargs.get("system_user")
    app_key = kwargs.get("app_key")
    secret_key = kwargs.get("secret_key")

    if config_path is None and (ip is None or port is None):
        print(
               "\nPipeline configuration failed. \nPlease provides configuration file path "
                "or server http ip address & port information."
        )
        return

    if config_path is None:
        config_path = default_config

    with Path(config_path).open("r") as fin:
        config = yaml.safe_load(fin)

    if ip:
        config["ip"] = ip
    if port:
        config["port"] = port
    if log_directory:
        config["log_directory"] = Path(log_directory).resolve().__str__()
    if app_key:
        config["app_key"] = app_key
    if secret_key:
        config["secret_key"] = secret_key

    if system_user:
        system_user = system_user.lower()
        if system_user not in ["guest", "host", "arbiter"]:
            raise ValueError(f"system_user {system_user} is not valid. Must be one of (guest, host, arbiter)")
        config["system_setting"] = {"role": system_user}

    with default_config.open("w") as fout:
        yaml.dump(config, fout, Dumper=yaml.RoundTripDumper)

    print("Pipeline configuration succeeded.")
def _init ( * * kwargs ) : config_path = kwargs . get ( "config_path" ) ip = kwargs . get ( "ip" ) port = kwargs . get ( "port" ) log_directory = kwargs . get ( "log_directory" ) system_user = kwargs . get ( "system_user" ) app_key = kwargs . get ( "app_key" ) secret_key = kwargs . get ( "secret_key" ) if config_path is None and ( ip is None or port is None ) : print ( "\nPipeline configuration failed. \nPlease provides configuration file path " "or server http ip address & port information." ) return if config_path is None : config_path = default_config with Path ( config_path ) . open ( "r" ) as fin : config = yaml . safe_load ( fin ) if ip : config [ "ip" ] = ip if port : config [ "port" ] = port if log_directory : config [ "log_directory" ] = Path ( log_directory ) . resolve ( ) . __str__ ( ) if app_key : config [ "app_key" ] = app_key if secret_key : config [ "secret_key" ] = secret_key if system_user : system_user = system_user . lower ( ) if system_user not in [ "guest" , "host" , "arbiter" ] : raise ValueError ( f"system_user {system_user} is not valid. Must be one of (guest, host, arbiter)" ) config [ "system_setting" ] = { "role" : system_user } with default_config . open ( "w" ) as fout : yaml . dump ( config , fout , Dumper = yaml . RoundTripDumper ) print ( "Pipeline configuration succeeded." )