Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when using SQLite with gRPC-rere #2874

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(),
)
Loading