当前位置: 首页 > 工具软件 > FATE > 使用案例 >

FATE 命令行学习笔记

咸正平
2023-12-01

使用方式

python fate_flow_client.py -f $command

JOB_OPERATE

submit_job

  • 提交一个pipeline 任务
  • 参数:
    • -c -config: runtime conf path, Required
    • -d -dsl: dsl path, Required
    python fate_flow_client.py -f submit_job -c examples/test_hetero_lr_job_conf.json -d examples/test_hetero_lr_job_dsl.json

stop_job

  • 取消或停掉一个任务
  • 参数:
    • -j -job_id: job id, Required
    python fate_flow_client.py -f stop_job -j $job_id

query_job

  • 查询任务
  • 参数:
    • -j -job_id: filter by job id, Optional
    • -r -role : filter by role, Optional
    • -p -party_id: filter by party id, Optional
    • -s -status: filter by status, Optional
    python fate_flow_client.py -f query_job -j $job_id
  • tips:
    • 什么参数都不加会报错
    • -p 只能查询命令行执行机器party-id 的任务,-r 只能查询命令行执行机器的role 的任务
    • 在guest端,不指定role 会有如下两条记录(因为我guest 和arbiter 部署在一个party 上)
(venv) [root@python-775c755456-68758 python]# python fate_flow/fate_flow_client.py -f query_job --j 2020102307283522583919
{
    "data": [
        {
            "f_create_time": 1603438115227,
            "f_current_steps": null,
            "f_current_tasks": "[\"2020102307283522583919_evaluation_0\"]",
            "f_description": "",
            "f_elapsed": 351373,
            "f_end_time": 1603438470294,
            "f_initiator_party_id": "2000",
            "f_is_initiator": 0,
            "f_job_id": "2020102307283522583919",
            "f_name": "",
            "f_party_id": "2000",
            "f_progress": 100,
            "f_role": "arbiter",
            "f_roles": "{\"guest\": [2000], \"host\": [2001], \"arbiter\": [2000]}",
            "f_run_ip": "10.200.115.170:9380",
            "f_start_time": 1603438118921,
            "f_status": "success",
            "f_tag": "job_end",
            "f_train_runtime_conf": "{}",
            "f_update_time": 1603438473082,
            "f_work_mode": 1
        },
        {
            "f_create_time": 1603438115227,
            "f_current_steps": null,
            "f_current_tasks": "[\"2020102307283522583919_evaluation_0\"]",
            "f_description": "",
            "f_elapsed": 351373,
            "f_end_time": 1603438470294,
            "f_initiator_party_id": "2000",
            "f_is_initiator": 1,
            "f_job_id": "2020102307283522583919",
            "f_name": "",
            "f_party_id": "2000",
            "f_progress": 100,
            "f_role": "guest",
            "f_roles": "{\"guest\": [2000], \"host\": [2001], \"arbiter\": [2000]}",
            "f_run_ip": "10.200.115.170:9380",
            "f_start_time": 1603438118921,
            "f_status": "success",
            "f_tag": "job_end",
            "f_train_runtime_conf": "{}",
            "f_update_time": 1603438473012,
            "f_work_mode": 1
        }
    ],
    "retcode": 0,
    "retmsg": "success"
}
+ 指定role 之后,只有一条记录
(venv) [root@python-775c755456-68758 python]# python fate_flow/fate_flow_client.py -f query_job -r guest --j 2020102307283522583919
{
    "data": [
        {
            "f_create_time": 1603438115227,
            "f_current_steps": null,
            "f_current_tasks": "[\"2020102307283522583919_evaluation_0\"]",
            "f_description": "",
            "f_elapsed": 351373,
            "f_end_time": 1603438470294,
            "f_initiator_party_id": "2000",
            "f_is_initiator": 1,
            "f_job_id": "2020102307283522583919",
            "f_name": "",
            "f_party_id": "2000",
            "f_progress": 100,
            "f_role": "guest",
            "f_roles": "{\"guest\": [2000], \"host\": [2001], \"arbiter\": [2000]}",
            "f_run_ip": "10.200.115.170:9380",
            "f_start_time": 1603438118921,
            "f_status": "success",
            "f_tag": "job_end",
            "f_train_runtime_conf": "{}",
            "f_update_time": 1603438473012,
            "f_work_mode": 1
        }
    ],
    "retcode": 0,
    "retmsg": "success"
}

(venv) [root@python-775c755456-68758 python]# 
+ 在host端,可以查到一条记录
(venv) [root@python-6dc56c97f7-8xqm8 python]# python fate_flow/fate_flow_client.py -f query_job -j 2020102307283522583919
{
    "data": [
        {
            "f_create_time": 1603438115227,
            "f_current_steps": null,
            "f_current_tasks": "[\"2020102307283522583919_evaluation_0\"]",
            "f_description": "",
            "f_elapsed": 351373,
            "f_end_time": 1603438470294,
            "f_initiator_party_id": "2000",
            "f_is_initiator": 0,
            "f_job_id": "2020102307283522583919",
            "f_name": "",
            "f_party_id": "2001",
            "f_progress": 100,
            "f_role": "host",
            "f_roles": "{\"guest\": [2000], \"host\": [2001], \"arbiter\": [2000]}",
            "f_run_ip": "10.200.198.4:9380",
            "f_start_time": 1603438118921,
            "f_status": "success",
            "f_tag": "job_end",
            "f_train_runtime_conf": "{}",
            "f_update_time": 1603438473047,
            "f_work_mode": 1
        }
    ],
    "retcode": 0,
    "retmsg": "success"
}

clean_job

  • 清理进程、数据表和metric 数据
  • 参数:
    • -j -job_id: filter by job id, Optional
    • -r -role : filter by role, Optional
    • -p -party_id: filter by party id, Optional
    • -cpn -component_name: component name, Optional
    python fate_flow_client.py -f clean_job -j $job_id
  • tips:
    • 用于删除在集群上的数据,log job 目录下不进行删除
# 删除前
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data -j 2020111209243082331516  -r guest -p 10000 -cpn hetero_lr_0  -o ho
{
    "retcode": 0,
    "directory": "/fate/fate_flow/ho/job_2020111209243082331516_hetero_lr_0_guest_10000_output_data",
    "retmsg": "download successfully, please check /fate/fate_flow/ho/job_2020111209243082331516_hetero_lr_0_guest_10000_output_data directory"
}


root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data -j 2020111209243082331516  -r guest -p 10000 -cpn intersection_0  -o io
{
    "retcode": 0,
    "directory": "/fate/fate_flow/io/job_2020111209243082331516_intersection_0_guest_10000_output_data",
    "retmsg": "download successfully, please check /fate/fate_flow/io/job_2020111209243082331516_intersection_0_guest_10000_output_data directory"
}

# 删除命令   
 python fate_flow_client.py -f clean_job -j 2020111209243082331516  -r guest -p 10000 -cpn intersection_0      

root@319fb87d1062:/fate/fate_flow#  python fate_flow_client.py -f clean_job -j 2020111209243082331516  -r guest -p 10000 -cpn intersection_0
{
    "retcode": 0,
    "retmsg": "success"
}

# 删除之后,再检查
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data -j 2020111209243082331516  -r guest -p 10000 -cpn intersection_0  -o io_1
{
    "retcode": 100,
    "retmsg": "download failed, please check if the parameters are correct"
}

root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data -j 2020111209243082331516  -r guest -p 10000 -cpn hetero_lr_0  -o ho_1
{
    "retcode": 0,
    "directory": "/fate/fate_flow/ho_1/job_2020111209243082331516_hetero_lr_0_guest_10000_output_data",
    "retmsg": "download successfully, please check /fate/fate_flow/ho_1/job_2020111209243082331516_hetero_lr_0_guest_10000_output_data directory"
}


data_view_query

  • 查看数据视图
  • 参数:
    • -j -job_id: filter by job id, Optional
    • -r -role : filter by role, Optional
    • -p -party_id: filter by party id, Optional
    • -s -status: filter by status, Optional
    python fate_flow_client.py -f data_view_query -j $job_id
  • tips
    • -p 只能查询命令行执行机器 party-id 的任务,-r 只能查询命令行执行机器的role 的任务
    • 可以显示这个job 中,每个component 的信息
(venv) [root@python-775c755456-68758 fate_flow]# python fate_flow_client.py -f data_view_query -j 2020102307283522583919

{
    "data": [
        {
            "f_component_name": "dataio_0",
            "f_create_time": 1603438130456,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": "2020102307283522583919",
            "f_partition": 16,
            "f_party_id": "2000",
            "f_party_model_id": "guest#2000#arbiter-2000#guest-2000#host-2001#model",
            "f_role": "guest",
            "f_size": 0,
            "f_table_count_actual": 469,
            "f_table_count_upload": null,
            "f_table_name": "case1_guest_20201023.072848.434_e5a8c296-0b5a-43b8-97a7-f325156149df",
            "f_table_namespace": "output_data_2020102307283522583919_dataio_0",
            "f_tag": "",
            "f_task_id": "2020102307283522583919_dataio_0",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438130471
        },
        {
            "f_component_name": "evaluation_0",
            "f_create_time": 1603438469780,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": null,
            "f_partition": null,
            "f_party_id": "2000",
            "f_party_model_id": null,
            "f_role": "guest",
            "f_size": 0,
            "f_table_count_actual": 0,
            "f_table_count_upload": null,
            "f_table_name": "",
            "f_table_namespace": "",
            "f_tag": "",
            "f_task_id": "2020102307283522583919_evaluation_0",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438469780
        },
        {
            "f_component_name": "hetero_lr_0",
            "f_create_time": 1603438456258,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": "2020102307283522583919",
            "f_partition": null,
            "f_party_id": "2000",
            "f_party_model_id": "arbiter#2000#arbiter-2000#guest-2000#host-2001#model",
            "f_role": "arbiter",
            "f_size": 0,
            "f_table_count_actual": 0,
            "f_table_count_upload": null,
            "f_table_name": "",
            "f_table_namespace": "",
            "f_tag": "",
            "f_task_id": "2020102307283522583919_hetero_lr_0",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438456277
        },
        {
            "f_component_name": "hetero_lr_0",
            "f_create_time": 1603438460728,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": "2020102307283522583919",
            "f_partition": 16,
            "f_party_id": "2000",
            "f_party_model_id": "guest#2000#arbiter-2000#guest-2000#host-2001#model",
            "f_role": "guest",
            "f_size": 0,
            "f_table_count_actual": 469,
            "f_table_count_upload": null,
            "f_table_name": "case1_guest_20201023.073419.510_190bc324-3cce-4596-9de9-a965d8e5e904",
            "f_table_namespace": "output_data_2020102307283522583919_hetero_lr_0",
            "f_tag": "",
            "f_task_id": "2020102307283522583919_hetero_lr_0",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438460747
        },
        {
            "f_component_name": "intersection_0",
            "f_create_time": 1603438149221,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": null,
            "f_partition": 16,
            "f_party_id": "2000",
            "f_party_model_id": null,
            "f_role": "guest",
            "f_size": 0,
            "f_table_count_actual": 469,
            "f_table_count_upload": null,
            "f_table_name": "case1_guest_20201023.072906.993_bb43cbb2-0971-41d4-bf4f-f126be76e327",
            "f_table_namespace": "output_data_2020102307283522583919_intersection_0",
            "f_tag": "",
            "f_task_id": "2020102307283522583919_intersection_0",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438149221
        },
        {
            "f_component_name": "pipeline",
            "f_create_time": 1603438472646,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": "2020102307283522583919",
            "f_partition": null,
            "f_party_id": "2000",
            "f_party_model_id": "arbiter#2000#arbiter-2000#guest-2000#host-2001#model",
            "f_role": "arbiter",
            "f_size": 0,
            "f_table_count_actual": null,
            "f_table_count_upload": null,
            "f_table_name": null,
            "f_table_namespace": null,
            "f_tag": "",
            "f_task_id": "2020102307283522583919_pipeline",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438472647
        },
        {
            "f_component_name": "pipeline",
            "f_create_time": 1603438470332,
            "f_description": "",
            "f_job_id": "2020102307283522583919",
            "f_model_version": "2020102307283522583919",
            "f_partition": null,
            "f_party_id": "2000",
            "f_party_model_id": "guest#2000#arbiter-2000#guest-2000#host-2001#model",
            "f_role": "guest",
            "f_size": 0,
            "f_table_count_actual": null,
            "f_table_count_upload": null,
            "f_table_name": null,
            "f_table_namespace": null,
            "f_tag": "",
            "f_task_id": "2020102307283522583919_pipeline",
            "f_ttl": 0,
            "f_type": null,
            "f_update_time": 1603438470332
        }
    ],
    "retcode": 0,
    "retmsg": "success"
}

JOB

job_config

  • 下载任务配置
  • 参数
    • -j -job_id: job id, Required
    • -r -role : role, Required
    • -p -party_id: party id, Required
    • -o -output_path: config output directory path, Required
python fate_flow_client.py -f job_config -j $job_id -r $role -p $party_id -o $output_path
  • tips
    • 下载的配置,就是我们任务的配置
python fate_flow_client.py -f job_config -j 2020111209243082331516 -r guest -p 10000 -o jc

# jc 目录中一个四个文件 
dsl.json: 同dsl 
model_info.json: model_id 和 model_version 非model 超参
runtime_conf.json: 同conf
train_runtime_conf.json: 空


python fate_flow_client.py -f job_config -j 2020111209243082331516 -r host -p 10000 -o jc
# 结果同guest

job_log

  • 下载任务日志
  • 参数
    • -j -job_id: job id, Required
    • -o -output_path: config output directory path, Required
python fate_flow_client.py -f job_log -j $job_id -o $output_path
  • tips
    • 获取到的log 只有本part 和 role 有的log,和本机的logs 目录下对应的job的log 是一致的。
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f job_log -j 2020111209243082331516  -o jl
{
    "retcode": 0,
    "directory": "/fate/fate_flow/jl/job_2020111209243082331516_log",
    "retmsg": "download successfully, please check /fate/fate_flow/jl/job_2020111209243082331516_log directory"
}

TASK_OPERATE

query_task

  • 查询task 的信息
  • 参数
    • -j -job_id: filter by job id, Optional
    • -cpn -component_name: filter by component name, Optional
    • -r -role : filter by role, Optional
    • -p -party_id: filter by party id, Optional
    • -s -status: filter by status, Optional
python fate_flow_client.py -f query_task -j $job_id
  • tips
    • 每个task 就是每个cpn 的执行情况,也就是涉及到cpn 和 task 的设计,cpn 是每个模块,是一个静态的概念,而task 是一个running 状态,是一个动态的概念。
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f query_task -j 2020111209243082331516 |grep f_component_name
            "f_component_name": "dataio_0",
            "f_component_name": "dataio_0",
            "f_component_name": "evaluation_0",
            "f_component_name": "evaluation_0",
            "f_component_name": "hetero_lr_0",
            "f_component_name": "hetero_lr_0",
            "f_component_name": "hetero_lr_0",
            "f_component_name": "intersection_0",
            "f_component_name": "intersection_0",

TRACKING

component_parameters

  • 查询指定cpn 的参数
  • 参数
    • -j -job_id: job id, Required
    • -cpn -component_name: component name, Required
    • -r -role: role, Required
    • -p -party_id: party id, Required
python fate_flow_client.py -f component_parameters -j $job_id -r $role -p $party_id -cpn $component_name
  • tips
python fate_flow_client.py -f component_parameters -j 2020111209243082331516 -r guest -p 10000 -cpn hetero_lr_0
返回指定cpn的参数,和config.json 一致

component_metric_all

  • 查询所有的metric
  • 参数
    • -j –job_id: job id, Required
    • -cpn –component_name: component name, Required
    • -r –role: role, Required
    • -p –party_id: party id, Required
python fate_flow_client.py -f component_metric_all -j $job_id -r $role -p $party_id -cpn $component_name
  • tips
    • 获取全部的metric
python fate_flow_client.py -f component_metric_all -j 2020111209243082331516 -r guest -p 10000 -cpn evaluation_0

# 获取全部的metric 
python fate_flow_client.py -f component_metric_all -j 2020111209243082331516 -r guest -p 10000 -cpn evaluation_0 |  grep metric_type
                    "metric_type": "EVALUATION_SUMMARY",
                    "metric_type": "ACCURACY_EVALUATION",
                    "metric_type": "CONFUSION_MAT",
                    "metric_type": "F1_SCORE",
                    "metric_type": "GAIN_EVALUATION",
                    "metric_type": "KS_EVALUATION",
                    "metric_type": "KS_EVALUATION",
                    "metric_type": "LIFT_EVALUATION",
                    "metric_type": "PRECISION_BINARY_EVALUATION",
                    "metric_type": "QUANTILE_PR",
                    "metric_type": "RECALL_BINARY_EVALUATION",
                    "metric_type": "ROC_EVALUATION",

component_metrics

  • 查询 metric list
  • 参数
    • -j –job_id: job id, Required
    • -cpn –component_name: component name, Required
    • -r –role: role, Required
    • -p –party_id: party id, Required
python fate_flow_client.py -f component_metrics -j $job_id -r $role -p $party_id -cpn $component_name
  • tips
    • 也就是上面 component_metric_all,grep metric_type 之后的记过
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_metrics -j 2020111209243082331516 -r guest -p 10000 -cpn evaluation_0
{
    "data": {
        "train": [
            "hetero_lr_0",
            "hetero_lr_0_ks_fpr",
            "hetero_lr_0_ks_tpr",
            "hetero_lr_0_lift",
            "hetero_lr_0_gain",
            "hetero_lr_0_accuracy",
            "hetero_lr_0_precision",
            "hetero_lr_0_recall",
            "hetero_lr_0_roc",
            "hetero_lr_0_confusion_mat",
            "hetero_lr_0_f1_score",
            "hetero_lr_0_quantile_pr"
        ]
    },
    "retcode": 0,
    "retmsg": "success"
}

component_output_model

  • 查询cpn 模型,比如lr的超参、data_io等模型
  • 参数
    • -j –job_id: job id, Required
    • -cpn –component_name: component name, Required
    • -r –role: role, Required
    • -p –party_id: party id, Required
python fate_flow_client.py -f component_output_model -j $job_id -r $role -p $party_id -cpn $component_name
  • tips
    • data_io、hetero_lr 这种,guest 和host 各自有自己的参数
    • evaluation 和 intersection_0 这种,则都为空
# data_io
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_model -j 2020111209243082331516 -r guest -p 10000 -cpn dataio_0
{
    "data": {
        "header": [
            "x0",
            "x1",
            "x2",
            "x3",
            "x4",
            "x5",
            "x6",
            "x7",
            "x8",
            "x9"
        ],
        "imputerParam": {
            "missingReplaceValue": {
                "x0": "0",
                "x1": "0",
                "x2": "0",
                "x3": "0",
                "x4": "0",
                "x5": "0",
                "x6": "0",
                "x7": "0",
                "x8": "0",
                "x9": "0"
            },
            "missingValueRatio": {
                "x0": 0.0,
                "x1": 0.0,
                "x2": 0.0,
                "x3": 0.0,
                "x4": 0.0,
                "x5": 0.0,
                "x6": 0.0,
                "x7": 0.0,
                "x8": 0.0,
                "x9": 0.0
            }
        },
        "labelName": "y",
        "outlierParam": {
            "outlierReplaceValue": {
                "x0": "0",
                "x1": "0",
                "x2": "0",
                "x3": "0",
                "x4": "0",
                "x5": "0",
                "x6": "0",
                "x7": "0",
                "x8": "0",
                "x9": "0"
            },
            "outlierValueRatio": {
                "x0": 0.0,
                "x1": 0.0,
                "x2": 0.0,
                "x3": 0.0,
                "x4": 0.0,
                "x5": 0.0,
                "x6": 0.0,
                "x7": 0.0,
                "x8": 0.0,
                "x9": 0.0
            }
        },
        "sidName": "id"
    },
    "meta": {
        "meta_data": {
            "dataType": "float64",
            "delimitor": ",",
            "exclusiveDataType": {},
            "imputerMeta": {
                "isImputer": true,
                "missingValue": [
                    "",
                    "none",
                    "null",
                    "na"
                ],
                "strategy": ""
            },
            "inputFormat": "dense",
            "labelName": "y",
            "labelType": "int",
            "needRun": true,
            "outlierMeta": {
                "isOutlier": true,
                "outlierValue": [
                    "",
                    "none",
                    "null",
                    "na"
                ],
                "strategy": ""
            },
            "outputFormat": "dense",
            "tagValueDelimitor": ":",
            "tagWithValue": false,
            "withLabel": true
        },
        "module_name": "DataIO"
    },
    "retcode": 0,
    "retmsg": "success"
}

# lr
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_model -j 2020111209243082331516 -r guest -p 10000 -cpn hetero_lr_0
{
    "data": {
        "bestIteration": -1,
        "header": [
            "x0",
            "x1",
            "x2",
            "x3",
            "x4",
            "x5",
            "x6",
            "x7",
            "x8",
            "x9"
        ],
        "intercept": 0.46162717395161823,
        "isConverged": false,
        "iters": 30,
        "lossHistory": [],
        "needOneVsRest": false,
        "weight": {
            "x0": 0.0157090910209103,
            "x1": -0.229707400009761,
            "x2": -0.25869168623169925,
            "x3": -0.10070910915750149,
            "x4": -0.07936575487298539,
            "x5": -0.23994598325350383,
            "x6": -0.07777771630274193,
            "x7": -0.4073751046586664,
            "x8": -0.3701441954606336,
            "x9": 0.19970347339762576
        }
    },
    "meta": {
        "meta_data": {
            "alpha": 0.01,
            "batchSize": "-1",
            "earlyStop": "weight_diff",
            "fitIntercept": true,
            "learningRate": 0.15,
            "maxIter": "30",
            "needOneVsRest": false,
            "optimizer": "nesterov_momentum_sgd",
            "partyWeight": 0.0,
            "penalty": "L2",
            "reEncryptBatches": "0",
            "tol": 0.0001
        },
        "module_name": "HeteroLR"
    },
    "retcode": 0,
    "retmsg": "success"
}


component_output_data

  • 下载当前cpn的输出数据
  • 参数
    • -j –job_id: job id, Required
    • -cpn –component_name: component name, Required
    • -r –role: role, Required
    • -p –party_id: party id, Required
    • -o –output_path: config output path, Required
    • -limit –limit: Limit quantity, Optional
python fate_flow_client.py -f component_output_data -j $job_id -r $role -p $party_id -cpn $component_name -o $output_path
  • tips
    • 只能下载本方的数据(这不是废话,不然不安全了)
    • 下载的是经过每个cpn处理过的数据,data_io 进行稀疏或者稠密处理,interect 进行求交处理,lr进行预测处理
# dataio
id,y,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9
0,0,1.88669,-1.359293,2.303601,2.001237,1.307686,2.616665,2.109526,2.296076,2.750622,1.937015
1,0,1.805927,-0.369203,1.535126,1.890489,-0.375612,-0.430444,-0.146749,1.087084,-0.24389,0.28119


# hetero_lr_0
id,label,predict_result,predict_score,predict_detail,type
0,0,0,0.1248809531437722,{'0': 0.8751190468562278, '1': 0.1248809531437722},train
1,0,0,0.43075357554296123,{'0': 0.5692464244570388, '1': 0.43075357554296123},train
3,0,0,0.12885456041529378,{'0': 0.8711454395847062, '1': 0.12885456041529378},train

# evaluation_0
{
    "retmsg": "no data",
    "retcode": 500
}

component_output_data_table

  • 获取dtable 的namespace 和 tablename
  • 参数
    • -j –ob_id: job id, Required
    • -cpn –component_name: component name, Required
    • -r –role: role, Required
    • -p –party_id: party id, Required
python fate_flow_client.py -f component_output_data_table -j $job_id -r $role -p $party_id -cpn $component_name
  • tips:
    • 每一步的tablename 和 namespace 都是系统自动生成的
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data_table  -j 2020111209243082331516 -r guest -p 10000 -cpn intersection_0
{
    "data": {
        "table_name": "e1d0ffc8-24c8-11eb-9182-0242ac1a0002",
        "table_namespace": "output_data_2020111209243082331516_intersection_0"
    },
    "retcode": 0,
    "retmsg": "success"
}

root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data_table  -j 2020111209243082331516 -r guest -p 10000 -cpn dataio_0
{
    "data": {
        "table_name": "df7c90c0-24c8-11eb-8ee1-0242ac1a0002",
        "table_namespace": "output_data_2020111209243082331516_dataio_0"
    },
    "retcode": 0,
    "retmsg": "success"
}

root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f component_output_data_table  -j 2020111209243082331516 -r guest -p 10000 -cpn hetero_lr_0
{
    "data": {
        "table_name": "2ce00d2e-24c9-11eb-bf62-0242ac1a0002",
        "table_namespace": "output_data_2020111209243082331516_hetero_lr_0"
    },
    "retcode": 0,
    "retmsg": "success"

DATA

  • 数据上传下载

download

  • 下载数据
  • 参数
    • -c –config: config path, Required
python fate_flow_client.py -f download -c examples/download_guest.json
  • download_guest.json 样例
{
  "output_path": "./fate_flow_test_breast_guest.csv",
  "work_mode": 0,
  "namespace": "fate_flow_test_breast_hetero",
  "table_name": "breast_hetero_guest"
}
  • tips
    • 还是只能下载本方的

upload

  • 上传数据
  • 参数
    • -c –config: config path, Required
    • -drop –drop: Operations before file upload, Optional
python fate_flow_client.py -f upload -c examples/upload_guest.json
python fate_flow_client.py -f upload -c examples/upload_guest.json -drop 0(or1)
  • upload_guest.json 样例
{
  "file": "examples/data/breast_hetero_guest.csv",
  "head": 1,
  "partition": 10,
  "work_mode": 0,
  "namespace": "fate_flow_test_breast_hetero",
  "table_name": "breast_hetero_guest"
}

upload_history

  • 上传历史
  • 参数
    • -j –job_id: job id, Optional
    • -limit –limit: Limit quantity, Optional
    python fate_flow_client.py -f upload_history -j $job_id
    python fate_flow_client.py -f upload_history -limit 5

Table

table_info

  • 查询表信息
  • 参数
    • -n –namespace: namespace, Required
    • -t –table_name: table name, Required
python fate_flow_client.py -f table_info -n $namespace -t $table_name
  • tips:
    • 只能访问本方的数据
root@319fb87d1062:/fate/fate_flow# python fate_flow_client.py -f table_info  -n case1 -t case1_guest
{
    "data": {
        "count": 469,
        "namespace": "case1",
        "partition": 1,
        "schema": {
            "header": "y,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9",
            "sid": "id"
        },
        "table_name": "case1_guest"
    },
    "retcode": 0,
    "retmsg": "success"
}

table_delete

  • 删除表
  • 参数
    • -n –namespace: namespace, Optional
    • -t –table_name: table name, Optional
    • -j –job_id: job id, Optional
    • -cpn –component_name: component name, Optional
    • -r –role: role, Optional
    • -p –party_id: party id, Optional
    python fate_flow_client.py -f table_delete -n $namespace -t $table_name
    python fate_flow_client.py -f table_delete -j $job_id
  • tips
    • 可以删除每个cpn 生成的临时数据
    python fate_flow_client.py -f table_delete -n $namespace -t $table_name
    python fate_flow_client.py -f table_delete -j $job_id

Model (存疑??)

load

  • 加载模型
  • 参数
    • -c –config: config path, Required
    python fate_flow_client.py -f load -c $conf_path
  • conf_path 样例
    {
        "data": {
            "detail": {
                "guest": {
                    "9999": {
                        "retcode": 0,
                        "retmsg": "xxx"
                    }
                },
                "host": {
                    "10000": {
                        "retcode": 0,
                        "retmsg": "xxx"
                    }
                }
            },
            "guest": {
                "9999": 0
            },
            "host": {
                "10000": 0
            }
        },
        "jobId": "xxxxxxxxxxxxxxxx",
        "retcode": 0,
        "retmsg": "success"
    }

bind

  • 绑定模型
  • 参数
    • -c –config: config path, Required
    python fate_flow_client.py -f bind -c $conf_path
response example:

{
    "retcode": 0,
    "retmsg": "service id is xxx"
}

store

description: store model

parameter:

    -c –config: config path, Required

python fate_flow_client.py -f store -c $conf_path

restore

description: restore mode

parameter:

    -c –config: config path, Required

python fate_flow_client.py -f restore -c $conf_path

export

description: export model

parameter:

    -c –config: config path, Required

python fate_flow_client.py -f export -c $conf_path

import

description: import model

parameter:

    -c –config: config path, Required

python fate_flow_client.py -f import -c $conf_path

REF

Fate CLI

 类似资料: