Skip to content

Commit

Permalink
Fix error when using SQLite with gRPC-rere (#2874)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbvll authored Jan 31, 2024
1 parent 12b0643 commit 44101fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/py/flwr/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def _run_fleet_api_grpc_rere(
"""Run Fleet API (gRPC, request-response)."""
# Create Fleet API gRPC server
fleet_servicer = FleetServicer(
state=state_factory.state(),
state_factory=state_factory,
)
fleet_add_servicer_to_server_fn = add_FleetServicer_to_server
fleet_grpc_server = generic_create_grpc_server(
Expand Down
14 changes: 7 additions & 7 deletions src/py/flwr/server/fleet/grpc_rere/fleet_servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
PushTaskResResponse,
)
from flwr.server.fleet.message_handler import message_handler
from flwr.server.state import State
from flwr.server.state import StateFactory


class FleetServicer(fleet_pb2_grpc.FleetServicer):
"""Fleet API servicer."""

def __init__(self, state: State) -> None:
self.state = state
def __init__(self, state_factory: StateFactory) -> None:
self.state_factory = state_factory

def CreateNode(
self, request: CreateNodeRequest, context: grpc.ServicerContext
Expand All @@ -48,7 +48,7 @@ def CreateNode(
log(INFO, "FleetServicer.CreateNode")
return message_handler.create_node(
request=request,
state=self.state,
state=self.state_factory.state(),
)

def DeleteNode(
Expand All @@ -58,7 +58,7 @@ def DeleteNode(
log(INFO, "FleetServicer.DeleteNode")
return message_handler.delete_node(
request=request,
state=self.state,
state=self.state_factory.state(),
)

def PullTaskIns(
Expand All @@ -68,7 +68,7 @@ def PullTaskIns(
log(INFO, "FleetServicer.PullTaskIns")
return message_handler.pull_task_ins(
request=request,
state=self.state,
state=self.state_factory.state(),
)

def PushTaskRes(
Expand All @@ -78,5 +78,5 @@ def PushTaskRes(
log(INFO, "FleetServicer.PushTaskRes")
return message_handler.push_task_res(
request=request,
state=self.state,
state=self.state_factory.state(),
)

0 comments on commit 44101fe

Please sign in to comment.