Skip to content

Commit

Permalink
Fix custom dir path passed to Flower client supernode subprocess (#3168)
Browse files Browse the repository at this point in the history
Fixes #3169.

### Description

Since the supernode is started with its current working directory set to
the client app dir, if the custom directory is not an absolute path, it
needs to be passed relative to the app dir.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [ ] Non-breaking change (fix or new feature that would not break
existing functionality).
- [X] 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.

Co-authored-by: Ziyue Xu <[email protected]>
  • Loading branch information
taleinat and ZiyueXu77 authored Jan 23, 2025
1 parent c859946 commit 67cbdf8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nvflare/app_opt/flower/applet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import time

from nvflare.apis.fl_context import FLContext
Expand Down Expand Up @@ -57,6 +58,8 @@ def get_command(self, ctx: dict) -> CommandDescriptor:
job_id = fl_ctx.get_job_id()
custom_dir = ws.get_app_custom_dir(job_id)
app_dir = ws.get_app_dir(job_id)
if not os.path.isabs(custom_dir):
custom_dir = os.path.relpath(custom_dir, app_dir)
cmd = f"flower-supernode --insecure --grpc-adapter --superlink {addr} {custom_dir}"

# use app_dir as the cwd for flower's client app.
Expand Down

0 comments on commit 67cbdf8

Please sign in to comment.