Skip to content

Commit

Permalink
inject create_at for compatibility stack
Browse files Browse the repository at this point in the history
  • Loading branch information
jafermarq committed Mar 27, 2024
1 parent e334756 commit 59ea8ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/py/flwr/server/compat/driver_client_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ def _send_receive_recordset(
ttl=DEFAULT_TTL,
),
)

# This would normally be recorded upon common.Message creation
# but this compatibility stack doesn't create Messages,
# so we need to inject `created_at` manually (needed for
# taskins validation by server.utils.validator)
task_ins.task.created_at = time.time()

push_task_ins_req = driver_pb2.PushTaskInsRequest( # pylint: disable=E1101
task_ins_list=[task_ins]
)
Expand Down
2 changes: 1 addition & 1 deletion src/py/flwr/server/utils/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def validate_task_ins_or_res(tasks_ins_res: Union[TaskIns, TaskRes]) -> List[str
tasks_ins_res.task.created_at < 1711497600.0
): # unix timestamp of 27 March 2024 00h:00m:00s UTC
validation_errors.append(
"`created_at` must be float that records the unix timestamp "
"`created_at` must be a float that records the unix timestamp "
"in seconds when the message was created."
)
if tasks_ins_res.task.delivered_at != "":
Expand Down

0 comments on commit 59ea8ee

Please sign in to comment.