Skip to content

Commit

Permalink
remove hardcode of online inference id test
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackCas committed Jan 6, 2022
1 parent 8fdfc27 commit 0f9b418
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ api_version: v1
component_name: hetero_lr_0
metric_output_path: ./output/metric/{}_hetero_lr_0.json
model_output_path: ./output/model/{}_hetero_lr_0.json
phone_num: 12345678900

flow_test_template:
train_conf_path: /examples/flow_test_template/hetero_lr/hetero_lr_normal_conf.json
Expand Down
1 change: 1 addition & 0 deletions examples/flow_test_template/homo_lr/flow_test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ component_name: homo_lr_0
component_is_homo: true
metric_output_path: ./output/metric/{}_homo_lr_0.json
model_output_path: ./output/model/{}_homo_lr_0.json
phone_num: 12345678900

flow_test_template:
train_conf_path: /examples/flow_test_template/homo_lr/homo_lr_train_conf.json
Expand Down
9 changes: 5 additions & 4 deletions python/fate_test/fate_test/flow_test/flow_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,19 @@ def bind_model(self):
f"details: {resp_data.get('retmsg')}")
raise Exception(f"Request model bind api failed, status code: {response.status_code}")

def online_predict(self, online_serving):
def online_predict(self, online_serving, phone_num):
serving_url = f"http://{online_serving}/federation/1.0/inference"
post_data = {
"head": {
"serviceId": self.service_id
},
"body": {
"featureData": {
"phone_num": "18576635456",
"phone_num": phone_num,
},
"sendToRemoteFeatureData": {
"device_type": "imei",
"phone_num": "18576635456",
"phone_num": phone_num,
"encrypt_type": "raw"
}
}
Expand Down Expand Up @@ -360,6 +360,7 @@ def run_fate_flow_test(config_json):
metric_output_path = config_json['metric_output_path']
model_output_path = config_json['model_output_path']
serving_connect_bool = serving_connect(config_json['serving_setting'])
phone_num = config_json['phone_num']

print('submit train job')
# train
Expand Down Expand Up @@ -400,4 +401,4 @@ def run_fate_flow_test(config_json):
utilize.bind_model()

# online predict
utilize.online_predict(online_serving=online_serving)
utilize.online_predict(online_serving=online_serving, phone_num=phone_num)
1 change: 1 addition & 0 deletions python/fate_test/fate_test/scripts/flow_test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def get_role(conf: Config):
'model_file_path': os.path.abspath(conf.data_base_dir) + flow_test_template['model_conf_path'],
'server_url': "http://{}/{}".format(flow_services, config['api_version']),
'train_auc': config['train_auc'],
'phone_num': config['phone_num'],
'component_name': config['component_name'],
'component_is_homo': config.get('component_is_homo', False),
'serving_setting': conf.serving_setting['serving_setting']['address'],
Expand Down

0 comments on commit 0f9b418

Please sign in to comment.