def apply_func(func, job_id, role, num_hosts, ind, *args): partyid_map = dict(host=[9999 + i for i in range(num_hosts)], guest=[9999], arbiter=[9999]) partyid = 9999 if role == consts.HOST: partyid = 9999 + ind with Session() as session: session.init_computing(job_id, computing_type=ComputingType.STANDALONE) session.init_federation(federation_session_id=job_id, runtime_conf={ "local": { "role": role, "party_id": partyid }, "role": partyid_map }) return func(job_id, role, ind, *args)
def _call(cls, job_id, role, transfer_variable, num_hosts, ind, *args): role_id = { "host": [ 10000 + i for i in range(num_hosts) ], "guest": [ 9999 ], "arbiter": [ 9999 ] } with Session() as session: session.init_computing(job_id, computing_type=ComputingType.STANDALONE) session.init_federation(job_id, runtime_conf={ "local": { "role": role, "party_id": role_id[role][0] if role != "host" else role_id[role][ind] }, "role": role_id }) return cls.call(role, transfer_variable, ind, *args)
result_data = selection_guest.save_data() local_data = result_data.collect() print("data in transform") for k, v in local_data: print("k: {}, v: {}".format(k, v.features)) def tearDown(self): self.table.destroy() if __name__ == '__main__': import sys job_id = str(sys.argv[1]) with Session() as session: session.init_computing(job_id, computing_type=ComputingType.STANDALONE) session.init_federation(job_id, runtime_conf={ "local": { "role": "guest", "party_id": 9999 }, "role": { "host": [10000], "guest": [9999] } }) selection_obj = TestHeteroFeatureSelection() selection_obj.test_feature_selection()
type=str, help="host party id", default='10000') parser.add_argument('-j', '--job_id', required=True, type=str, help="job_id") args = parser.parse_args() job_id = args.job_id guest_id = args.gid host_id = args.hid role = args.role with Session.create(0, 0) as session: session.init_computing(job_id) session.init_federation( federation_session_id=job_id, parties_info=PartiesInfo(local=Party( role, guest_id if role == GUEST else host_id), role_to_parties={ "host": [Party("host", host_id)], "guest": [Party("guest", guest_id)] })) test_obj = TestHeteroFeatureBinning(role, guest_id, host_id) # homo_obj.test_homo_lr() test_obj.test_feature_binning() test_obj.tearDown()