Skip to content

Improve Compose encapsulation - #6224

Merged
wyli merged 33 commits into
devfrom
compose_refactor
Mar 30, 2023
Merged

Improve Compose encapsulation#6224
wyli merged 33 commits into
devfrom
compose_refactor

Conversation

@atbenmurray

Copy link
Copy Markdown
Collaborator

Fixes #6223 .

Description

A few sentences describing the changes proposed in this pull request.

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.

@wyli

wyli commented Mar 22, 2023

Copy link
Copy Markdown
Contributor

/black

@atbenmurray

Copy link
Copy Markdown
Collaborator Author

@ericspod, @Nic-Ma, @rijobro, @wyli
I'm writing up the test extensions for this, but please take a look at the code changes when you have a moment. I'm essentially trying to eliminate the need for dataset.py to have to be updated by the lazy resampling changes coming up in #5860.

monai-bot and others added 3 commits March 22, 2023 14:06
Signed-off-by: monai-bot <monai.miccai2019@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Comment thread monai/data/dataset.py
I, Ben Murray <ben.murray@gmail.com>, hereby add my Signed-off-by to this commit: 1759f96

Signed-off-by: Ben Murray <ben.murray@gmail.com>q:
I, Ben Murray <ben.murray@gmail.com>, hereby add my Signed-off-by to this commit: 1759f96

Signed-off-by: Ben Murray <ben.murray@gmail.com>
I, Ben Murray <ben.murray@gmail.com>, hereby add my Signed-off-by to this commit: 10edabd

Signed-off-by: Ben Murray <ben.murray@gmail.com>
…edataset_persistent_workers pass

Signed-off-by: Ben Murray <ben.murray@gmail.com>
@atbenmurray

Copy link
Copy Markdown
Collaborator Author

Taking the opportunity boost the docstrings a little. It looks as if logging only does anything when the pipeline raises an exception of some kind, so the comment for that parameter should be updated, yes?

Signed-off-by: Ben Murray <ben.murray@gmail.com>
@wyli

wyli commented Mar 22, 2023

Copy link
Copy Markdown
Contributor

I think the refactoring makes sense, let me trigger some integration tests about multiprocessing

wyli added 2 commits March 22, 2023 17:13
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>

@wyli wyli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the integration tests work fine, could you please revise the docstrings, and in my opinion we can merge this. more tests with Compose.execute would be great as well.

@Nic-Ma Nic-Ma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The change logic looks good to me, put minor comments inline.
Please complete the doc-strings and double-confirm the threading arg in the self.transform() function of every dataset class.

Thanks.

Comment thread monai/transforms/compose.py Outdated
Comment thread monai/data/dataset.py Outdated
@atbenmurray

Copy link
Copy Markdown
Collaborator Author

@wyli @Nic-Ma what is the issue with the failure? Not sure what is causing it

@wyli

wyli commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

@wyli @Nic-Ma what is the issue with the failure? Not sure what is causing it

those tests are optional and deprecating... please ignore

I, Ben Murray <ben.murray@gmail.com>, hereby add my Signed-off-by to this commit: 61f67e4

Signed-off-by: Ben Murray <ben.murray@gmail.com>
atbenmurray and others added 5 commits March 24, 2023 17:36
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Comment thread monai/data/dataset.py
@atbenmurray

atbenmurray commented Mar 28, 2023

Copy link
Copy Markdown
Collaborator Author

If everyone is happy review-wise, I'll sort out the remaining reds in anticipation of a merge
@ericspod suggested that I make Compose.execute a function rather than having it as a class method, so I'll do that first before we review for merge.

@wyli

wyli commented Mar 28, 2023

Copy link
Copy Markdown
Contributor

If everyone is happy review-wise, I'll sort out the remaining reds in anticipation of a merge

please update the docstring of the datasets to clarify the implicit execution of pending operations during caching. otherwise this looks good to me.

Comment thread monai/transforms/compose.py
… Documenting lazy resampling functionality and updating dataset docs to refer to it as per @wyli's request

Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
I, Ben Murray <ben.murray@gmail.com>, hereby add my Signed-off-by to this commit: 6bdedac

Signed-off-by: Ben Murray <ben.murray@gmail.com>
through list comprehension

Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
execute_compose.

Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
critical design flaw that needs fixing

Signed-off-by: Ben Murray <ben.murray@gmail.com>
code with an incorrect type

Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: Ben Murray <ben.murray@gmail.com>
@atbenmurray
atbenmurray marked this pull request as ready for review March 30, 2023 09:35
@wyli

wyli commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

/build

@wyli
wyli enabled auto-merge (squash) March 30, 2023 13:30
@wyli
wyli merged commit e4d48f0 into dev Mar 30, 2023
@wyli
wyli deleted the compose_refactor branch March 30, 2023 13:59
a-parida12 pushed a commit to a-parida12/MONAI that referenced this pull request Apr 3, 2023
Fixes Project-MONAI#6223 .

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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.
- [ ] 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.

---------

Signed-off-by: Ben Murray <ben.murray@gmail.com>
Signed-off-by: a-parida12 <abhijeet.parida@tum.de>
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.

Refactor: improve Compose encapsulation and eliminate need for non-Compose code to duplicate compose functionality

6 participants