Skip to content

Commit

Permalink
Merge branch 'handle-clientapp-exception-simulation' into terminate-u…
Browse files Browse the repository at this point in the history
…pdate-clientmanager-thread-externally
  • Loading branch information
jafermarq committed Mar 28, 2024
2 parents 2913cf2 + 6056ac1 commit 0b8884d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/py/flwr/server/superlink/fleet/vce/vce_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# ==============================================================================
"""Fleet Simulation Engine API."""


import asyncio
import json
import sys
import time
import traceback
from logging import DEBUG, ERROR, INFO, WARN
Expand Down Expand Up @@ -89,11 +89,6 @@ async def worker(
log(DEBUG, "Terminating Async worker: %s", e)
break

except LoadClientAppError as load_ex:
log(ERROR, load_ex)
log(ERROR, traceback.format_exc())
raise load_ex

# Exceptions aren't raised but reported as an error message
except Exception as ex: # pylint: disable=broad-exception-caught
log(ERROR, ex)
Expand Down Expand Up @@ -313,6 +308,10 @@ def backend_fn() -> Backend:
def _load() -> ClientApp:

if client_app_attr:

if app_dir is not None:
sys.path.insert(0, app_dir)

app: ClientApp = load_app(client_app_attr, LoadClientAppError)

if not isinstance(app, ClientApp):
Expand Down
3 changes: 2 additions & 1 deletion src/py/flwr/server/superlink/fleet/vce/vce_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from unittest import IsolatedAsyncioTestCase
from uuid import UUID

from flwr.client.client_app import LoadClientAppError
from flwr.common import (
DEFAULT_TTL,
GetPropertiesIns,
Expand Down Expand Up @@ -193,7 +194,7 @@ def test_erroneous_client_app_attr(self) -> None:
state_factory, nodes_mapping, _ = init_state_factory_nodes_mapping(
num_nodes=num_nodes, num_messages=num_messages
)
with self.assertRaises(RuntimeError):
with self.assertRaises(LoadClientAppError):
start_and_shutdown(
client_app_attr="totally_fictitious_app:client",
state_factory=state_factory,
Expand Down

0 comments on commit 0b8884d

Please sign in to comment.