Skip to content

fix(mlops): fix bind_simulation_device positional argument mismatch (… - #2270

Open
laasyapriya2007 wants to merge 1 commit into
FedML-AI:masterfrom
laasyapriya2007:fix-issue-work
Open

laasyapriya2007 wants to merge 1 commit into
FedML-AI:masterfrom
laasyapriya2007:fix-issue-work

Conversation

@laasyapriya2007

Copy link
Copy Markdown

Summary

Fixes #2171.

Root Cause

In python/fedml/core/mlops/__init__.py, bind_simulation_device was being invoked with three arguments (args, api_key, args.config_version), but the function was defined accepting only two (args, userid). This resulted in a runtime error:
TypeError: bind_simulation_device() takes 2 positional arguments but 3 were given.

Additionally, inside bind_simulation_device, the local variable assignment version = fedml.get_env_version() shadowed any incoming version parameter.

Solution

  1. Added version="release" optional parameter to bind_simulation_device(args, userid, version="release"), making it compatible with both 2-argument and 3-argument callers.
  2. Renamed the shadowed local variable to env_version = fedml.get_env_version() so args.config_version correctly uses the specified version when provided.
  3. Used getattr(args, "config_version", "release") before calling bind_simulation_device to prevent potential AttributeError when args lacks config_version.

This branch has not been deployed

No deployments
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.

bind_simulation_device() takes 2 positional arguments but 3 were given

1 participant