安装
pipeline与fate_client一起分布。
pip install fate_client
要使用Pipeline,我们需要首先指定要连接到哪个FATE流服务。安装FATE_client后,可以找到cmd入口名称Pipeline:
!pipeline --help
Usage: pipeline [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
config pipeline config tool
init - DESCRIPTION: Pipeline Config Command.
假设我们在127.0.0.1:9380中有一个FATE流服务(默认为独立模式),然后执行
!pipeline init --ip 127.0.0.1 --port 9380
Pipeline configuration succeeded.
上载数据
在开始建模任务之前,应上载要使用的数据。通常,一方通常是包含多个节点的集群。因此,当我们上传这些数据时,数据将被分配给这些节点。
from pipeline.backend.pipeline import PipeLine
创建 pipeline 实例:
- 发起:
* role: guest
* party: 9999
- 角色:
* guest: 9999
注意,只需要本地方id。
pipeline_upload = PipeLine().set_initiator(role='guest', party_id=9999).set_roles(guest=9999)
定义数据存储的分区
partition = 4
定义将在FATE作业配置中使用的表名和命名空间
dense_data_guest = {"name": "breast_hetero_guest", "namespace": f"experiment"}
dense_data_host = {"name": "breast_hetero_host", "namespace": f"experiment"}
tag_data = {"name": "breast_hetero_host", "namespace": f"experiment"}
现在,我们添加要上载的数据
import os
# data_base = "/workspace/FATE/"
# file参数根据自己的文件位置进行调整
pipeline_upload.add_upload_data(file="./examples/data/breast_hetero_guest.csv",
table_name=dense_data_guest["name"], # table name
namespace=dense_data_guest["namespace"], # namespace
head=1, partition=partition) # data info
pipeline_upload.add_upload_data(file="./examples/data/breast_hetero_host.csv",
table_name=dense_data_host["name"],
namespace=dense_data_host["namespace"],
head=1, partition=partition)
pipeline_upload.add_upload_data(file="./examples/data/breast_hetero_host.csv",
table_name=tag_data["name"],
namespace=tag_data["namespace"],
head=1, partition=partition)
然后我们可以上传数据
pipeline_upload.upload(drop=1)
有关使用pipeline提交作业的更多演示,请参阅pipeline演示