Skip to content

[Task Runner API] [Flower Interoperability] Pull ConnectorFlower, FlowerTaskRunner/FlowerDataLoader, and FlowerInteropServer/FlowerInteropClient into core OpenFL#1633

Merged
teoparvanov merged 33 commits intosecurefederatedai:developfrom
kminhta:integrate_connector_local_grpc_and_taskrunner
May 22, 2025
Merged

[Task Runner API] [Flower Interoperability] Pull ConnectorFlower, FlowerTaskRunner/FlowerDataLoader, and FlowerInteropServer/FlowerInteropClient into core OpenFL#1633
teoparvanov merged 33 commits intosecurefederatedai:developfrom
kminhta:integrate_connector_local_grpc_and_taskrunner

Conversation

@kminhta
Copy link
Copy Markdown
Collaborator

@kminhta kminhta commented May 17, 2025

Note: This PR is a branch from #1598 so it includes Collaborator related commits that'll be mostly discarded once that PR is pulled and this one is rebased. The reason for the relatively large PR compared to the aggregator and collaborator PRs is because these had some interdependencies that was easier to handle at once.

Summary

This PR pulls in the ConnectorFlower, related interop components (FlowerInteropServer & FlowerInteropClient), and the FlowerTaskRunner & FlowerDataLoader back into core OpenFL as well as provides consistency in how gRPC ports are handled using the auto key and a hash of the plan (ref: #1433 (comment))

Type of Change (Mandatory)

Specify the type of change being made.

  • Feature enhancement (improved gRPC port assignment in Flower components)
  • Refactor (pulling in workspace components)

Description (Mandatory)

  • Pulls in ConnectorFlower
    • rename the plan default connector.yaml -> connector_flower.yaml
    • move a few settings from plan.yaml into connector_flower.yaml and set some of the ports to auto
    • expand args in ConnectorFlower to reflect the new yaml key hierarchy (no longer embedded under superlink_params and flwr_run_params - this was necessary to be able to modify a subset of the default values without needing to include all the values in plan.yaml
    • add flwr_dir to the plan, which sets the FLWR_HOME directory (important for SGX and general security or else flower will build their app outside the workspace inside of /.flwr)
  • Pulls in FlowerInteropServer / FlowerInteropClient
    • updates imports to reflect new directory structure
    • update FlowerInteropServer to add the automatically set port instead of dynamically adjust it itself
  • Pulls in FlowerTaskRunner / FlowerDataLoader
    • rename the plan default task_connector.yaml -> task_flower.yaml
    • add defaults to prepare interop server, pass in client port, and local simulation
    • automatically assign port numbers
    • local simulation added to further adjust port to avoid port conflicts. uses collaborator name to create a hash then dynamically set port using from openfl.utilities.utils import generate_port
    • add flwr_dir to the Task Runner plan, which sets the FLWR_HOME directory (important for SGX and general security or else flower will build their app outside the workspace inside of /.flwr)
    • makes adjustment to install_flower_FAB to reflect new handling of flwr_dir and to minimize directory traversal
  • new generate_port() which uses the same logic when getting the agg_port during the plan resolve in order to also auto generate gRPC ports for the connector/interop components. Updates openfl/federated/plan/plan.py to reflect this when initially resolving the plan
  • handle path security by removing <workspace>/src/util/is_safe_path() and using OpenFL's built-in is_directory_traversal()
  • pin flwr-nightly -> this version enables us to remove our patches, but later versions toward 1.9 stable release interferes with SGX (need to further investigate)
  • refactoring in plan to support changes above
  • Need to verify in SGX
  • Need to update README and possibly docstrings

Testing

Manual in non-SGX and SGX

kminhta and others added 16 commits May 8, 2025 14:28
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
… local_grpc_server to interop_server

Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
kminhta added 10 commits May 19, 2025 08:13
Signed-off-by: kta-intel <kevin.ta@intel.com>
… default location and use openfl's directory traversal check

Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
@kminhta kminhta marked this pull request as ready for review May 19, 2025 23:33
@kminhta kminhta requested a review from teoparvanov as a code owner May 19, 2025 23:33
Signed-off-by: kta-intel <kevin.ta@intel.com>
@kminhta kminhta changed the title [WIP] [Task Runner API] [Flower Interoperability] Pull ConnectorFlower, FlowerTaskRunner/FlowerDataLoader, and FlowerInteropServer/FlowerInteropClient into core OpenFL [Task Runner API] [Flower Interoperability] Pull ConnectorFlower, FlowerTaskRunner/FlowerDataLoader, and FlowerInteropServer/FlowerInteropClient into core OpenFL May 19, 2025
kminhta and others added 4 commits May 19, 2025 17:04
Signed-off-by: kta-intel <kevin.ta@intel.com>
Signed-off-by: kta-intel <kevin.ta@intel.com>
Copy link
Copy Markdown
Collaborator

@teoparvanov teoparvanov left a comment

Choose a reason for hiding this comment

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

This is great, thanks @kta-intel !

Comment thread openfl/component/connector/__init__.py Outdated
kminhta and others added 2 commits May 21, 2025 09:46
Signed-off-by: kta-intel <kevin.ta@intel.com>
@teoparvanov teoparvanov merged commit 3a72c98 into securefederatedai:develop May 22, 2025
37 checks passed
ishaileshpant pushed a commit to ishaileshpant/openfl that referenced this pull request May 29, 2025
…FlowerTaskRunner`/`FlowerDataLoader`, and `FlowerInteropServer`/`FlowerInteropClient` into core OpenFL (securefederatedai#1633)

* integrate flower collaborator into core collaborator

Signed-off-by: kta-intel <kevin.ta@intel.com>

* formatting

Signed-off-by: kta-intel <kevin.ta@intel.com>

* change task name interop -> prepare_for_interop, change references to local_grpc_server to interop_server

Signed-off-by: kta-intel <kevin.ta@intel.com>

* add prepare_interop_server as callback to run on_experiment_begin

Signed-off-by: kta-intel <kevin.ta@intel.com>

* fix typo

Signed-off-by: kta-intel <kevin.ta@intel.com>

* change to on_round_begin()

Signed-off-by: kta-intel <kevin.ta@intel.com>

* return empty dict

Signed-off-by: kta-intel <kevin.ta@intel.com>

* set self.prepare_interop_server() to run on experiment begin

Signed-off-by: kta-intel <kevin.ta@intel.com>

* remove self-explanatory comment, added another comment for clarity

Signed-off-by: kta-intel <kevin.ta@intel.com>

* fix plan parsing and automatic assignment of grpc ports

Signed-off-by: kta-intel <kevin.ta@intel.com>

* move taskrunner and dataloader to core openfl.federated

Signed-off-by: kta-intel <kevin.ta@intel.com>

* move connector and interop components to core openfl

Signed-off-by: kta-intel <kevin.ta@intel.com>

* remove comments about patch

Signed-off-by: kta-intel <kevin.ta@intel.com>

* remove collaborator number setting, it is not being used

Signed-off-by: kta-intel <kevin.ta@intel.com>

* adjust handling of flower directory. enabling user configuration with default location and use openfl's directory traversal check

Signed-off-by: kta-intel <kevin.ta@intel.com>

* exit system if error

Signed-off-by: kta-intel <kevin.ta@intel.com>

* update REAMDE.md

Signed-off-by: kta-intel <kevin.ta@intel.com>

* update docstring

Signed-off-by: kta-intel <kevin.ta@intel.com>

* override self.port

Signed-off-by: kta-intel <kevin.ta@intel.com>

* remove tasks_connector.yaml

Signed-off-by: kta-intel <kevin.ta@intel.com>

* updates

Signed-off-by: kta-intel <kevin.ta@intel.com>

* pin flwr

Signed-off-by: kta-intel <kevin.ta@intel.com>

* remove time

Signed-off-by: kta-intel <kevin.ta@intel.com>

* formatting

Signed-off-by: kta-intel <kevin.ta@intel.com>

* formatting

Signed-off-by: kta-intel <kevin.ta@intel.com>

* formatting

Signed-off-by: kta-intel <kevin.ta@intel.com>

* copyright

Signed-off-by: kta-intel <kevin.ta@intel.com>

---------

Signed-off-by: kta-intel <kevin.ta@intel.com>
Co-authored-by: teoparvanov <teodor.parvanov@intel.com>
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