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

[BUG] nvflare provision doesn't exit with a code >0 on input validation errors #3296

Open
ferrarimarco opened this issue Mar 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@ferrarimarco
Copy link

Describe the bug

Running nvflare provision against a project.yml that doesn't pass argument checks returns a 0 exit code, making it impossible to reliably use the nvflare provision command in scripts, unless the script parses nvflare provision output.

To Reproduce

Steps to reproduce the behavior:

  1. Create a project.yml with the following contents:
api_version: 3
name: example_project
description: NVIDIA FLARE sample project yaml file

participants:
  - name: server1.nvidia-flare-example.com
    type: server
    org: nvidia
    fed_learn_port: 8002
    admin_port: 8003
  # The following line fails validation
  - name: client1.example.com
    type: client
    org: nvidia
  - name: [email protected]
    type: admin
    org: nvidia
    role: project_admin

builders:
  - path: nvflare.lighter.impl.workspace.WorkspaceBuilder
    args:
      template_file: master_template.yml
  - path: nvflare.lighter.impl.template.TemplateBuilder
  - path: nvflare.lighter.impl.static_file.StaticFileBuilder
    args:
      config_folder: config
      overseer_agent:
        path: nvflare.ha.dummy_overseer_agent.DummyOverseerAgent
        overseer_exists: false
        args:
          sp_end_point: server1:8002:8003

  - path: nvflare.lighter.impl.cert.CertBuilder
  - path: nvflare.lighter.impl.signature.SignatureBuilder
  1. Run nvflare provision

  2. Observe the output:

Unable to handle command: provision due to: name=client1.nvidia-flare-example.com is ill-formatted based on regex_pattern=^[A-Za-z0-9-_]+$ 

sub_parser is: ArgumentParser(prog='nvflare provision', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
usage: nvflare provision [-h] [-p PROJECT_FILE] [-w WORKSPACE] [-c CUSTOM_FOLDER] [--add_user ADD_USER] [--add_client ADD_CLIENT]

optional arguments:
  -h, --help            show this help message and exit
  -p PROJECT_FILE, --project_file PROJECT_FILE
                        file to describe FL project
  -w WORKSPACE, --workspace WORKSPACE
                        directory used by provision
  -c CUSTOM_FOLDER, --custom_folder CUSTOM_FOLDER
                        additional folder to load python codes
  --add_user ADD_USER   yaml file for added user
  --add_client ADD_CLIENT
                        yaml file for added client
  1. Get the exit code:
echo $?
  1. Observe the output:
0

Expected behavior

nvflare provision should return a non-zero exit code on validation errors.

Environment (please complete the following information):

Reproducible using the nvflare docker image: nvflare/nvflare:2.4.2

@ferrarimarco ferrarimarco added the bug Something isn't working label Mar 12, 2025
@ferrarimarco ferrarimarco changed the title [BUG] nvflare provision doesn't exit with a code >0 on errors [BUG] nvflare provision doesn't exit with a code >0 on input validation errors Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant