Skip to content

Commit

Permalink
Make the optional arg "--callable" in flower-client a required posi…
Browse files Browse the repository at this point in the history
…tional arg. (#2673)

Co-authored-by: Javier <[email protected]>
  • Loading branch information
panh99 and jafermarq authored Dec 22, 2023
1 parent 3dd6cab commit 6562724
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
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 &
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 &
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

0 comments on commit 6562724

Please sign in to comment.