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

Add a property for each LoggerDestination to Logger #2577

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eracah
Copy link
Contributor

@eracah eracah commented Sep 28, 2023

What does this PR do?

adds a property decorator for each loggerdestination, so a user can easily get a loggerdestination by just calling mlflow_logger = trainer.logger.mlflow for example

Comment on lines 150 to 159
def _get_logger_destination(self, logger_type) -> Optional[Union[LoggerDestination, Sequence[LoggerDestination]]]:
"""Returns instances of the specified logger destination, if it/they exist."""
# Check every time just in case user appended to destinations list later.
logger_destinations = [destination for destination in self.destinations if isinstance(destination, logger_type)]
if len(logger_destinations) == 1:
return logger_destinations[0]
elif len(logger_destinations) > 1:
return logger_destinations
else: # length is 0
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we type all of the functions so it's easy for users?

Also, I'm not sure i love its sometimes list and sometimes not because end user then always has to check for both scenarios. Can we say it always returns a list? Because usually I just want to apply operation to all logger destinations of that type

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.

2 participants