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

Add Flower SuperExec plugin #2855

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

panh99
Copy link

@panh99 panh99 commented Aug 27, 2024

Description

This PR adds a FlowerSuperExecPlugin in the new file plugin.py under the nvflare/app_opt/flower/ directory. It enables users to run a Flower app with a Flare backend using the flwr run command, which is the same as how it is done in pure Flower.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Quick tests passed locally by running ./runtest.sh.
  • In-line docstrings updated.
  • Documentation updated.

Copy link
Collaborator

@yanchengnv yanchengnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to use FlowerJob instead of building the job on your own.

nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
nvflare/app_opt/flower/plugin.py Outdated Show resolved Hide resolved
Comment on lines 150 to 154
# Locate all allowed files in the FAB directory
tmp_dir = _copy_to_tmp_dir(Path(fab_path))

# Create FedJob
job = FlowerJob(job_name, tmp_dir)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @yanchengnv . May I know if this is the correct way to use FlowerJob? I somehow got a strange custom folder after exporting the Flower job:
image

The temporary folder that contains all flower files is correct:
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot directly pass tmp_dir to FlowerJob as "flower_content".
FlowerJob requires the "flower_content" to be a str, whereas tmp_dir is Path.
You need to pass str(tmp_dir) to FlowerJob.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yanchengnv Thanks so much for your help! I've just updated the PR.

Copy link
Collaborator

@yanchengnv yanchengnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please pass a "str" as "flower_content" to FlowerJob.

Comment on lines 150 to 154
# Locate all allowed files in the FAB directory
tmp_dir = _copy_to_tmp_dir(Path(fab_path))

# Create FedJob
job = FlowerJob(job_name, tmp_dir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot directly pass tmp_dir to FlowerJob as "flower_content".
FlowerJob requires the "flower_content" to be a str, whereas tmp_dir is Path.
You need to pass str(tmp_dir) to FlowerJob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants