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

remove redundant methods in RichProgressBar #11100

Merged
merged 15 commits into from
Dec 17, 2021
Merged

remove redundant methods in RichProgressBar #11100

merged 15 commits into from
Dec 17, 2021

Conversation

quancs
Copy link
Member

@quancs quancs commented Dec 16, 2021

What does this PR do?

after #10896 _init_progress should run in the spawned processes already. We can remove this setstate method entirely.
see #10875 (comment)

Does your PR introduce any breaking changes? If yes, please list them.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

@quancs quancs changed the title to Optional[Dict[str, Any], Console] construct RichProgressBar using Console directly Dec 16, 2021
@awaelchli
Copy link
Contributor

This PR does not address the comment you are linking to. There must be a misunderstanding. Two scenarios:

  1. Either the Console object is pickleable and you can construct it on the main process, pass it in to the callback,
  2. Or, the Console object is not pickleble, hence we only store the kwargs and make sure we construct it only in the worker process

Only one of the two applies, and given the existing code I suspect 2 is the case.

@quancs
Copy link
Member Author

quancs commented Dec 17, 2021

This PR does not address the comment you are linking to. There must be a misunderstanding. Two scenarios:

1. Either the Console object is pickleable and you can construct it on the main process, pass it in to the callback,

2. Or, the Console object is not pickleble, hence we only store the kwargs and make sure we construct it only in the worker process

Only one of the two applies, and given the existing code I suspect 2 is the case.

OK, then what should I do in this PR

@awaelchli
Copy link
Contributor

I believe just removing this code:

    def __getstate__(self):
        # can't pickle the rich progress objects
        state = self.__dict__.copy()
        state["progress"] = None
        state["_console"] = None
        return state
    def __setstate__(self, state):
        self.__dict__ = state
        self._console = Console(**self._console_kwargs)

@quancs
Copy link
Member Author

quancs commented Dec 17, 2021

@awaelchli removed.

@quancs quancs changed the title construct RichProgressBar using Console directly remove redundent methods in RichProgressBar Dec 17, 2021
@mergify mergify bot added the ready PRs ready to be merged label Dec 17, 2021
@awaelchli awaelchli enabled auto-merge (squash) December 17, 2021 17:02
@awaelchli awaelchli changed the title remove redundent methods in RichProgressBar remove redundant methods in RichProgressBar Dec 17, 2021
@awaelchli awaelchli disabled auto-merge December 17, 2021 17:02
@awaelchli awaelchli enabled auto-merge (squash) December 17, 2021 17:02
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM !

@awaelchli awaelchli merged commit 179b4dd into Lightning-AI:master Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants