Federation API¶
Low level api¶
Classes:
federation, get or remote objects and tables |
- class FederationABC¶
federation, get or remote objects and tables
Methods:
get(name, tag, parties, gc)get objects/tables from
partiesremote(v, name, tag, parties, gc)remote object/table to
parties- abstract get(name: str, tag: str, parties: List[fate_arch.common._types.Party], gc: fate_arch.abc._gc.GarbageCollectionABC) List¶
get objects/tables from
parties- Parameters
name (str) – name of transfer variable
tag (str) – tag to distinguish each transfer
parties (List[Party]) – parties to get objects/tables from
gc (GarbageCollectionABC) – used to do some clean jobs
- Returns
a list of object or a list of table get from parties with same order of parties
- Return type
list
- abstract remote(v, name: str, tag: str, parties: List[fate_arch.common._types.Party], gc: fate_arch.abc._gc.GarbageCollectionABC) NoReturn¶
remote object/table to
parties- Parameters
v (object or table) – object/table to remote
name (str) – name of transfer variable
tag (str) – tag to distinguish each transfer
parties (List[Party]) – parties to remote object/table to
gc (GarbageCollectionABC) – used to do some clean jobs
- Return type
Notes
user api¶
remoting or getting an object(table) from other parties is quite easy using apis provided in Variable.
First to create an instance of BaseTransferVariable, which is simply a collection of Variables:
from federatedml.transfer_variable.transfer_class import secure_add_example_transfer_variable
variable = secure_add_example_transfer_variable.SecureAddExampleTransferVariable()
Then remote or get object(table) by variable provided by this instance:
# remote
variable.guest_share.remote("from guest")
# get
variable.guest_share.get()
Classes:
|
variable to distinguish federation by name |
- class Variable(name: str, src: Tuple[str, ...], dst: Tuple[str, ...])¶
variable to distinguish federation by name
Methods:
remote_parties(obj, parties[, suffix])remote object to specified parties
get_parties(parties[, suffix])get objects/tables from specified parties
remote(obj[, role, idx, suffix])send obj to other parties.
get([idx, suffix])get obj from other parties.
- remote_parties(obj, parties: Union[List[fate_arch.common._types.Party], fate_arch.common._types.Party], suffix: Union[Any, Tuple] = ())¶
remote object to specified parties
- Parameters
obj (object or table) – object or table to remote
parties (List[Party]) – parties to remote object/table to
suffix (str or tuple of str) – suffix used to distinguish federation with in variable
- Return type
None
- get_parties(parties: Union[List[fate_arch.common._types.Party], fate_arch.common._types.Party], suffix: Union[Any, Tuple] = ())¶
get objects/tables from specified parties
- Parameters
parties (List[Party]) – parties to remote object/table to
suffix (str or tuple of str) – suffix used to distinguish federation with in variable
- Returns
a list of objects/tables get from parties with same order of
parties- Return type
list
- remote(obj, role=None, idx=- 1, suffix=())¶
send obj to other parties.
- Parameters
obj – object to be sent
role – role of parties to sent to, use one of [‘Host’, ‘Guest’, ‘Arbiter’, None]. The default is None, means sent values to parties regardless their party role
idx – id of party to sent to. The default is -1, which means sent values to parties regardless their party id
suffix – additional tag suffix, the default is tuple()
- get(idx=- 1, suffix=())¶
get obj from other parties.
- Parameters
idx – id of party to get from. The default is -1, which means get values from parties regardless their party id
suffix – additional tag suffix, the default is tuple()
- Returns
object or list of object