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

5821 Enhance bundle CLI entry for different bundle workflows #6181

Merged
merged 20 commits into from
Apr 3, 2023

Conversation

Nic-Ma
Copy link
Contributor

@Nic-Ma Nic-Ma commented Mar 20, 2023

part of #5821 .

Description

This PR enhanced the bundle CLI entry to support different customized bundle workflows.

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.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma Nic-Ma added this to the Bundle class [P1 v1.2] milestone Mar 20, 2023
@Nic-Ma Nic-Ma self-assigned this Mar 20, 2023
@Nic-Ma Nic-Ma changed the title [WIP] 5821 Enhance bundle CLI entry for different bundle workflows 5821 Enhance bundle CLI entry for different bundle workflows Mar 21, 2023
@Nic-Ma Nic-Ma marked this pull request as ready for review March 21, 2023 07:48
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

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

I have a few concerns with backwards compatibility with this change. I see what your intent is and that it does work correctly, but if someone has a command line python -m monai.bundle run some_expr they would need to have python -m monai.bundle run --run_id some_expr? Even besides that, because the arguments are being removed from the signature of the function the help output from Fire gives less information about what the arguments are, and what they are for, since all the important values get put into **kwargs.

monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Outdated Show resolved Hide resolved
@ericspod
Copy link
Member

Also it looks like the premerge tests are failing for related reasons, that is the command line has changed.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Mar 31, 2023

Hi @ericspod ,

Thanks for your review and suggestions.
I totally updated the PR based on the comments and added tests, could you please help review it again?

Thanks in advance.

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Mar 31, 2023

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Mar 31, 2023

/build

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Mar 31, 2023

/build

Signed-off-by: Nic Ma <nma@nvidia.com>
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

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

Looks good, I have very minor style suggestions. I see you're using pydoc.locate here and I wonder if we should have our own function in monai.utils.module for doing this. This is a topic for some other time and place but I had used something like this in the past that worked well enough:

def find_type_def(qualified_name: str):
    if "." not in qualified_name:
        modname, defname = "builtins", qualified_name
    else:
        modname, defname = qualified_name.rsplit(".", 1)

    mod = __import__(modname)
    return getattr(mod, defname)

monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Show resolved Hide resolved
monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Outdated Show resolved Hide resolved
monai/bundle/scripts.py Show resolved Hide resolved
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

Hi @ericspod ,

Thanks for your review, I updated the PR accordingly.
And for the locate suggestion, I created a ticket to discuss and track: #6275.
Because we use locate in several places of current codebase:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/networks/nets/flexible_unet.py#L16

https://github.com/Project-MONAI/MONAI/blob/dev/monai/utils/module.py#L244

https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/io/array.py#L208

If we want to change them together, maybe better to do a separate PR?

Thanks.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/build

1 similar comment
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/build

@ericspod
Copy link
Member

ericspod commented Apr 3, 2023

If we want to change them together, maybe better to do a separate PR?

Thanks.

Thanks I see that issue now. It should be done separately yes.

@Nic-Ma Nic-Ma enabled auto-merge (squash) April 3, 2023 14:33
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/build

1 similar comment
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

/build

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Apr 3, 2023

Hi @wyli ,

Do you know the root cause of Blossom system error here?

Thanks in advance.

@wyli
Copy link
Contributor

wyli commented Apr 3, 2023

/build

@Nic-Ma Nic-Ma merged commit 6aa4f90 into Project-MONAI:dev Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants