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

'Parallel' object has no attribute '_name' in Parallel.warn #1483

Open
percevalw opened this issue Jul 7, 2023 · 2 comments
Open

'Parallel' object has no attribute '_name' in Parallel.warn #1483

percevalw opened this issue Jul 7, 2023 · 2 comments

Comments

@percevalw
Copy link

Hi,

Since v1.3.1, calling Parallel.warn produces this error

.../parallel.py in ...
    109       executor = Parallel(
    110            n_jobs, backend="multiprocessing", prefer="processes", verbose=verbose
    111         )
--> 112     executor.warn(message)
    113 

~/.../site-packages/joblib/logger.py in warn(self, msg)
     78 
     79     def warn(self, msg):
---> 80         logging.getLogger(self._name).warning("[%s]: %s" % (self, msg))
     81 
     82     def info(self, msg):

AttributeError: 'Parallel' object has no attribute '_name'

I think Parallel.__init__ is missing a super().__init__ call to let the Logger class set the _name attribute.

@fcharras
Copy link
Contributor

fcharras commented Aug 8, 2023

Thank you for the feedback, I think this can be fix quickly by adding super().__init__ indeed.

But I'm not sure why Parallel inherits from Logger here, since the methods it adds are not used by Parallel like it is in memory.py, was there really an intent to expose the logging methods as public methods to the users ? @GaelVaroquaux maybe you have more insight to provide on the initial intent ? I had a discussion with @tomMoral that suggests exposing the Logger methods in Parallel could be deprecated.

@fcharras
Copy link
Contributor

The issue should be solved after yesterday patch release. Let's keep open for discussion about possible deprecation ?

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

No branches or pull requests

2 participants