diff --git a/.env.example b/.env.example index dd187aa..37bc893 100644 --- a/.env.example +++ b/.env.example @@ -21,3 +21,7 @@ TZ=America/Montreal # UDP port of the VPN server. If unset, 51820 is used #VPN_SERVER_PORT=51820 + +# MTU limit (max should be 1420) +VPN_MTU=1280 + diff --git a/.gitignore b/.gitignore index 8ef30a3..5d7d8f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Vim +*~ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[codz] diff --git a/README.md b/README.md index 31e9616..641f409 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,14 @@ docker compose down To start from scratch, delete everything in `vpnserver_config/`, `researcher_vpn_config/` and `fbm-researcher/` except `.gitkeep` and `config.env.sample`. +### Troubleshooting + +Run the script below to get the human-readable node name for every node that can connect to the researcher: + +```bash +docker compose exec -u fedbiomed researcher python /brainflex-server/scripts/get_node_names.py +``` + ## Development This project uses [uv](https://docs.astral.sh/uv/). diff --git a/docker-compose.yml b/docker-compose.yml index 15b3450..9211643 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: vpn-server: container_name: brainflex-vpn-server-${FBM_CONTAINER_INSTANCE_ID:-default} hostname: brainflex-vpn-server-${FBM_CONTAINER_INSTANCE_ID:-default} - image: ghcr.io/neurodatascience/brainflex-vpn-server:0.1.0@sha256:29e6463ae5696478913ff0c0973729c10af426f6507ecdb27f6c0be38038a1fd + image: ghcr.io/neurodatascience/brainflex-vpn-server:0.1.1@sha256:deb1ab2c842b6cd36afa7c2345928090b4172c453b50be30169b5c11957e5d84 cap_add: - net_admin # needed to handle wireguard interface devices: @@ -38,7 +38,7 @@ services: researcher-vpn: container_name: brainflex-researcher-vpn-${FBM_CONTAINER_INSTANCE_ID:-default} hostname: brainflex-researcher-${FBM_CONTAINER_INSTANCE_ID:-default} - image: ghcr.io/neurodatascience/brainflex-vpn-client:0.1.0@sha256:1c353258abde508771422e71384301aea88915b2f34bd2e236f3c8a9ab250de4 + image: ghcr.io/neurodatascience/brainflex-vpn-client:0.1.1@sha256:e0696dda58501ca46954f4844842fd97e6b4476509fa0f835ad1f34107e34faf cap_add: - net_admin # needed to handle wireguard interface devices: diff --git a/scripts/get_node_names.py b/scripts/get_node_names.py new file mode 100755 index 0000000..4631ebb --- /dev/null +++ b/scripts/get_node_names.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +"""Print the node name and other identifying fields of every connected node.""" + +from fedbiomed.common.message import ListRequest +from fedbiomed.researcher.federated_workflows import Experiment + + +def main() -> None: + exp = Experiment() # no tags + message = ListRequest(researcher_id=exp.researcher_id) + + with exp.requests.send(message) as federated_req: + replies = federated_req.replies() + + if not replies: + print("No node replied") + return + + for node_id, reply in replies.items(): + fields = reply.get_dict() if hasattr(reply, "get_dict") else vars(reply) + print(f"\n=== {node_id} ===") + for key, value in fields.items(): + if key == "databases": + print(f" {key}: {len(value)} dataset(s)") + else: + print(f" {key}: {value}") + + +if __name__ == "__main__": + main() diff --git a/scripts/request_training_plan_approval.py b/scripts/request_training_plan_approval.py index 8f70f59..caef4ad 100755 --- a/scripts/request_training_plan_approval.py +++ b/scripts/request_training_plan_approval.py @@ -3,10 +3,12 @@ """Request the approval of the training plans by the nodes.""" import argparse +import faulthandler import sys from _tasks import COMMON_TAG, TASKS from fedbiomed.common.constants import TrainingPlanApprovalStatus +from fedbiomed.common.logger import logger from fedbiomed.researcher.federated_workflows import Experiment from fedbiomed.researcher.federated_workflows.jobs import ( TrainingPlanApproveJob, @@ -17,9 +19,14 @@ TRAINING_PLAN_NOT_REGISTERED = "Not Registered" STATUS_SENT = "sent for approval" - def _get_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument( + "--debug", + nargs="?", + const=-1, + help="Enable debug mode. Pass with an integer value n to exit after n seconds with a traceback.", + ) parser.add_argument( "--task", dest="tasks", @@ -82,6 +89,15 @@ def _request_approval(task: str) -> dict[str, str]: def main(argv: list[str] | None = None) -> None: args = _get_parser().parse_args(argv) + if args.debug: + logger.setLevel("DEBUG") + try: + debug_seconds = int(args.debug) + except TypeError: + pass + else: + if debug_seconds > 0: + faulthandler.dump_traceback_later(debug_seconds, exit=True) all_approved = True for task in args.tasks or list(TASKS): try: