(ctx, **kwargs)
\b
    - DESCRIPTION:
        Export the model to a file or storage engine.

    \b
    - USAGE:
        flow model export -c fate_flow/examples/export_model.json
        flow model export -c fate_flow/examples/store_model.json --to-database
\b
    - DESCRIPTION:
        Export the model to a file or storage engine.
\ b - DESCRIPTION : Export the model to a file or storage engine .
def export_model(ctx, **kwargs):
    """
    \b
    - DESCRIPTION:
        Export the model to a file or storage engine.

    \b
    - USAGE:
        flow model export -c fate_flow/examples/export_model.json
        flow model export -c fate_flow/examples/store_model.json --to-database
    """
    config_data, dsl_data = preprocess(**kwargs)
    if not config_data.pop('to_database'):
        with closing(access_server('get', ctx, 'model/export', config_data, False, stream=True)) as response:
            if response.status_code == 200:
                archive_file_name = re.findall("filename=(.+)", response.headers["Content-Disposition"])[0]
                os.makedirs(config_data["output_path"], exist_ok=True)
                archive_file_path = os.path.join(config_data["output_path"], archive_file_name)
                with open(archive_file_path, 'wb') as fw:
                    for chunk in response.iter_content(1024):
                        if chunk:
                            fw.write(chunk)
                response_dict = {'retcode': 0,
                                 'file': archive_file_path,
                                 'retmsg': 'download successfully, please check {}'.format(archive_file_path)}
            else:
                response_dict = response.json() if isinstance(response, requests.models.Response) else response.json
        prettify(response_dict)
    else:
        access_server('post', ctx, 'model/store', config_data)
def export_model ( ctx , * * kwargs ) : config_data , dsl_data = preprocess ( * * kwargs ) if not config_data . pop ( 'to_database' ) : with closing ( access_server ( 'get' , ctx , 'model/export' , config_data , False , stream = True ) ) as response : if response . status_code == 200 : archive_file_name = re . findall ( "filename=(.+)" , response . headers [ "Content-Disposition" ] ) [ 0 ] os . makedirs ( config_data [ "output_path" ] , exist_ok = True ) archive_file_path = os . path . join ( config_data [ "output_path" ] , archive_file_name ) with open ( archive_file_path , 'wb' ) as fw : for chunk in response . iter_content ( 1024 ) : if chunk : fw . write ( chunk ) response_dict = { 'retcode' : 0 , 'file' : archive_file_path , 'retmsg' : 'download successfully, please check {}' . format ( archive_file_path ) } else : response_dict = response . json ( ) if isinstance ( response , requests . models . Response ) else response . json prettify ( response_dict ) else : access_server ( 'post' , ctx , 'model/store' , config_data )