fml_manager.utils package

Submodules

fml_manager.utils.core module

fml_manager.utils.core.base64_decode(src)
fml_manager.utils.core.base64_encode(src)
fml_manager.utils.core.bytes_to_string(byte)
fml_manager.utils.core.current_timestamp()
fml_manager.utils.core.deserialize_b64(src)
fml_manager.utils.core.get_commit_id()
fml_manager.utils.core.get_fate_uuid()
fml_manager.utils.core.get_lan_ip()
fml_manager.utils.core.json_dumps(src, byte=False)
fml_manager.utils.core.json_loads(src)
fml_manager.utils.core.serialize_b64(src, to_str=False)
fml_manager.utils.core.string_to_bytes(string)
fml_manager.utils.core.timestamp_to_date(timestamp, format_string='%Y-%m-%d %H:%M:%S')

fml_manager.utils.fate_builders module

class fml_manager.utils.fate_builders.AlgorithmParametersBuilder

Bases: object

build()
with_algorithm(algorithm: str) → object
with_parameters(*parameters) → object
Parameters:parameters – The available parameters in FATE, for more details please refer to parameters <https://github.com/FederatedAI/FATE/blob/master/federatedml/conf/default_runtime_conf/logistic_regression_param.json>
Returns:
class fml_manager.utils.fate_builders.Component

Bases: object

Component is used to describe steps in a pipline

to_dict()

Convert Component to dictionary

Return type:dict
class fml_manager.utils.fate_builders.ComponentBuilder

Bases: object

ComponentBuilder is used to build Component instance

build()
reset()
with_input_data(*data)

Set input data

with_input_eval_data(*eval_data)

Set input data for evaluation

with_input_isometric_model(*isometric_model)

Set input isometric model

with_input_model(*model)

Set input model

with_input_train_data(*train_data)

Set input data for training

with_module(module)

Set component module

Parameters:module (string) – The available module in FATE, for more details please refer to Modules <https://github.com/FederatedAI/FATE/tree/master/federatedml>
with_name(name)

Set component name

Parameters:name (string) – name of the component
with_need_deploy(need_deploy)

Set ‘need_deploy’ for DataIO module

Parameters:need_deploy (bool) – Value of need_deploy
with_output_data(*data)

Set output data

with_output_model(*model)

Set output model

class fml_manager.utils.fate_builders.Config

Bases: object

to_dict() → dict
class fml_manager.utils.fate_builders.ConfigBuilder

Bases: object

build() → dict
with_algorithm_parameters(algorithm_parameters: fml_manager.utils.fate_builders.AlgorithmParametersBuilder) → object
with_initiator(initiator: fml_manager.utils.fate_builders.InitiatorBuilder) → object
with_job_parameters(job_parameters: fml_manager.utils.fate_builders.JobParameterBuilder) → object
with_role(role: fml_manager.utils.fate_builders.RoleBuilder) → object
with_role_parameters(role_parameters: fml_manager.utils.fate_builders.RoleParameterBuilder) → object
class fml_manager.utils.fate_builders.InitiatorBuilder

Bases: object

build() → dict
Returns:
with_party_id(part_id: int) → object
Parameters:part_id
Returns:
with_role(role: str) → object
Parameters:role
Returns:
class fml_manager.utils.fate_builders.JobParameterBuilder

Bases: object

build() → dict
Returns:
with_work_mode(work_mode: int) → object
Parameters:work_mode
Returns:
class fml_manager.utils.fate_builders.Party

Bases: object

Party is used to define route table record

get_id() → str

Get party ID

Return type:string
set_id(party_id) → None

Set party ID

Parameters:party_id (string) – The ID of party
set_ip(party_ip) → None

Set IP address of party

Parameters:party_ip (string) – The IP address of party
set_port(party_port) → None

Set service port of the party

Parameters:party_port (int) – The service port of party
set_type(party_type) → None

Set party type

Parameters:party_id – The type of party
to_entry_point() → dict

Get entrypoint of party

Return type:dict
class fml_manager.utils.fate_builders.PartyBuilder

Bases: object

PartyBuilder is used to construct party instance

build()

Return party instance with config

Return type:Party
reset() → None

Reset the previous instance

with_id(party_id)

Update ID

Parameters:party_id (string) – The ID of party
with_ip(party_ip)

Update IP

Parameters:party_ip (string) – The IP of party
with_port(party_port)

Update port

Parameters:party_port (int) – The port of party
with_type(party_type)

Update type

Parameters:party_type (PartyType) – The type of party
class fml_manager.utils.fate_builders.PartyType

Bases: enum.Enum

PartyType is used to identified the type of party

EXCHANGE = 2

For exchange

NORMAL = 1

For normal party

class fml_manager.utils.fate_builders.Pipline

Bases: object

Pipline is used to described pipline in FATE

to_dict()
class fml_manager.utils.fate_builders.PiplineBuilder

Bases: object

PiplineBuilder is used to build pipline instance

build()
reset()
with_components(*components)
class fml_manager.utils.fate_builders.QueryCondition(job_id)

Bases: object

QueryCondition is context for job query

get_job_id()

Fetch the job id

Return type:dict
set_job_id(job_id)

Set job id

Parameters:job_id (string) – The uuid of job
class fml_manager.utils.fate_builders.RoleBuilder

Bases: object

build() → dict
Returns:
with_arbiter(arbiter: int) → object
Parameters:arbiter
Returns:
with_guest(guest: int) → object
Parameters:guest
Returns:
with_host(host: int) → object
Parameters:host
Returns:
class fml_manager.utils.fate_builders.RoleParameterBuilder

Bases: object

build() → dict
Returns:
with_guest_args_data_train_data(train_data: fml_manager.utils.fate_builders.TrainData) → object
Parameters:train_data
Returns:
with_guest_dataio_0_label_name(name: str) → object
Parameters:name
Returns:
with_guest_dataio_0_label_type(type: str) → object
Parameters:type
Returns:
with_guest_dataio_0_output_format(format: str) → object
Parameters:format
Returns:
with_guest_dataio_0_with_label(label: bool) → object
Parameters:label
Returns:
with_host_args_data_train_data(train_data: fml_manager.utils.fate_builders.TrainData) → object
Parameters:train_data
Returns:
with_host_dataio_0_output_format(format: str) → object
Parameters:format
Returns:
with_host_dataio_0_with_label(label: bool) → object
Parameters:label
Returns:
class fml_manager.utils.fate_builders.RouteTable

Bases: object

RouteTable is used to communicate with other parties

add_party(*parties) → None

Append parties to route table

Parameters:parties (list) – A list of party instance
from_dict(route_table)

Load route table config from dict

Parameters:route_table (dict) – The underlying route table
Return type:RouteTable
get_party() → dict

List all parties

Return type:dict
remove_party(*party_ids) → None

Remove parties from route table

Parameters:parties (list) – A list of party ID
to_dict() → dict

Return underlying route table

Return type:dict
update_party(*parties) → None

Update parties of route table

Parameters:parties (list) – A list of party instance
class fml_manager.utils.fate_builders.TrainData

Bases: dict

{“name”: “breast_b”, “namespace”: “fate_flow_test_breast”}

fml_manager.utils.fate_builders.deepSearch(dict1, dict2)

fml_manager.utils.file_utils module

fml_manager.utils.file_utils.dump_json_conf(config_data, conf_path)
fml_manager.utils.file_utils.get_project_base_directory()
fml_manager.utils.file_utils.load_json_conf(conf_path)

Module contents