10
10
from fedn .common .log_config import logger
11
11
from fedn .network .clients .fedn_client import ConnectToApiResult , FednClient , GrpcConnectionOptions
12
12
from fedn .network .combiner .modelservice import get_tmp_path
13
- from fedn .utils .helpers .helpers import get_helper
13
+ from fedn .utils .helpers .helpers import get_helper , save_metadata
14
14
15
15
16
16
def get_url (api_url : str , api_port : int ) -> str :
@@ -132,15 +132,15 @@ def set_helper(self, response: GrpcConnectionOptions = None):
132
132
# Priority: helper_type from constructor > helper_type from response > default helper_type
133
133
self .helper = get_helper (helper_type_to_use )
134
134
135
- def on_train (self , in_model ):
136
- out_model , meta = self ._process_training_request (in_model )
135
+ def on_train (self , in_model , client_settings ):
136
+ out_model , meta = self ._process_training_request (in_model , client_settings )
137
137
return out_model , meta
138
138
139
139
def on_validation (self , in_model ):
140
140
metrics = self ._process_validation_request (in_model )
141
141
return metrics
142
142
143
- def _process_training_request (self , in_model : BytesIO ) -> Tuple [BytesIO , dict ]:
143
+ def _process_training_request (self , in_model : BytesIO , client_settings : dict ) -> Tuple [BytesIO , dict ]:
144
144
"""Process a training (model update) request.
145
145
146
146
:param in_model: The model to be updated.
@@ -156,6 +156,8 @@ def _process_training_request(self, in_model: BytesIO) -> Tuple[BytesIO, dict]:
156
156
with open (inpath , "wb" ) as fh :
157
157
fh .write (in_model .getbuffer ())
158
158
159
+ save_metadata (metadata = client_settings , filename = inpath )
160
+
159
161
outpath = self .helper .get_tmp_path ()
160
162
161
163
tic = time .time ()
0 commit comments