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

Make the optional arg "--callable" in flower-client a required positional arg. #2673

Merged
merged 14 commits into from
Dec 22, 2023
Merged
4 changes: 2 additions & 2 deletions e2e/test_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ esac
timeout 2m flower-server $server_arg &
sleep 3

timeout 2m flower-client $client_arg --callable client:flower --server 127.0.0.1:9092 &
timeout 2m flower-client client:flower $client_arg --server 127.0.0.1:9092 &
danieljanes marked this conversation as resolved.
Show resolved Hide resolved
sleep 3

timeout 2m flower-client $client_arg --callable client:flower --server 127.0.0.1:9092 &
timeout 2m flower-client client:flower $client_arg --server 127.0.0.1:9092 &
danieljanes marked this conversation as resolved.
Show resolved Hide resolved
sleep 3

timeout 2m python driver.py &
Expand Down
4 changes: 2 additions & 2 deletions examples/mt-pytorch-callable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ flower-server --insecure
In a new terminal window, start the first long-running Flower client:

```bash
flower-client --callable client:flower
flower-client --insecure client:flower
```

In yet another new terminal window, start the second long-running Flower client:

```bash
flower-client --callable client:flower
flower-client --insecure client:flower
```

## Start the Driver script
Expand Down
2 changes: 1 addition & 1 deletion examples/mt-pytorch-callable/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def client_fn(cid: str):
return FlowerClient().to_client()


# To run this: `flower-client --callable client:flower`
# To run this: `flower-client client:flower`
flower = fl.flower.Flower(
client_fn=client_fn,
)
Expand Down
17 changes: 9 additions & 8 deletions src/py/flwr/client/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def run_client() -> None:

print(args.root_certificates)
print(args.server)
print(args.callable_dir)
print(args.dir)
print(args.callable)

callable_dir = args.callable_dir
callable_dir = args.dir
if callable_dir is not None:
sys.path.insert(0, callable_dir)

Expand All @@ -101,6 +101,10 @@ def _parse_args_client() -> argparse.ArgumentParser:
description="Start a long-running Flower client",
)

parser.add_argument(
"callable",
help="For example: `client:flower` or `project.package.module:wrapper.flower`",
)
parser.add_argument(
"--insecure",
action="store_true",
Expand All @@ -120,13 +124,10 @@ def _parse_args_client() -> argparse.ArgumentParser:
help="Server address",
)
parser.add_argument(
"--callable",
help="For example: `client:flower` or `project.package.module:wrapper.flower`",
)
parser.add_argument(
"--callable-dir",
"--dir",
default="",
help="Add specified directory to the PYTHONPATH and load callable from there."
help="Add specified directory to the PYTHONPATH and load Flower "
"callable from there."
" Default: current working directory.",
)

Expand Down
Loading