Skip to content

Commit e848af1

Browse files
authored
End of round callback adjustment (#1568)
* fix exp end callback Signed-off-by: Balakrishnan, Senthil <[email protected]> * try invoking e.o.r callback after saving model Signed-off-by: Balakrishnan, Senthil <[email protected]> --------- Signed-off-by: Balakrishnan, Senthil <[email protected]>
1 parent d27b952 commit e848af1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

openfl/component/aggregator/aggregator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,17 +1148,17 @@ def _end_of_round_check(self):
11481148
# Once all of the task results have been processed
11491149
self._end_of_round_check_done[self.round_number] = True
11501150

1151-
# End of round callbacks.
1152-
# todo handle case when aggregator restarted before callback was successful
1153-
self.callbacks.on_round_end(self.round_number, logs)
1154-
11551151
# Save the latest model
11561152
if not self.assigner.is_task_group_evaluation():
11571153
logger.info("Saving round %s model...", self.round_number)
11581154
self._save_model(self.round_number, self.last_state_path)
11591155
else:
11601156
logger.info("Skipping model save for round %s in evaluation mode.", self.round_number)
11611157

1158+
# End of round callbacks.
1159+
# todo handle case when aggregator restarted before callback was successful
1160+
self.callbacks.on_round_end(self.round_number, logs)
1161+
11621162
self.round_number += 1
11631163

11641164
# resetting stragglers for task for a new round
@@ -1171,6 +1171,8 @@ def _end_of_round_check(self):
11711171
# TODO This needs to be fixed!
11721172
if self._time_to_quit():
11731173
logger.info("Experiment Completed. Cleaning up...")
1174+
# End of experiment callbacks.
1175+
self.callbacks.on_experiment_end()
11741176
else:
11751177
logger.info("Starting round %s...", self.round_number)
11761178
# https://github.com/securefederatedai/openfl/pull/1195#discussion_r1879479537

0 commit comments

Comments
 (0)