12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #
- # Copyright 2019 The FATE Authors. All Rights Reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- import os
- import argparse
- from pipeline.backend.pipeline import PipeLine
- # path to data
- # default fate installation path
- DATA_BASE = "/data/projects/fate"
- # site-package ver
- # import site
- # DATA_BASE = site.getsitepackages()[0]
- def main(data_base=DATA_BASE):
- # parties config
- guest = 9999
- # partition for data storage
- partition = 4
- # table name and namespace, used in FATE job configuration
- dense_data = {"name": "breast_hetero_guest", "namespace": f"experiment"}
- tag_data = {"name": "breast_hetero_host", "namespace": f"experiment"}
- pipeline_upload = PipeLine().set_initiator(role="guest", party_id=guest).set_roles(guest=guest)
- # add upload data info
- # path to csv file(s) to be uploaded, modify to upload designated data
- # This is an example for standalone version. For cluster version, you will need to upload your data
- # on each party respectively.
- pipeline_upload.add_upload_data(file=os.path.join(data_base, "examples/data/breast_hetero_guest.csv"),
- table_name=dense_data["name"], # table name
- namespace=dense_data["namespace"], # namespace
- head=1, partition=partition) # data info
- pipeline_upload.add_upload_data(file=os.path.join(data_base, "examples/data/breast_hetero_host.csv"),
- table_name=tag_data["name"],
- namespace=tag_data["namespace"],
- head=1, partition=partition)
- # upload data
- pipeline_upload.upload(drop=1)
- if __name__ == "__main__":
- parser = argparse.ArgumentParser("PIPELINE DEMO")
- parser.add_argument("--base", "-b", type=str,
- help="data base, path to directory that contains examples/data")
- args = parser.parse_args()
- if args.base is not None:
- main(args.base)
- else:
- main()
|