FATE —— 一.2 pipeline上传数据教程

安装

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演示

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值