-
Notifications
You must be signed in to change notification settings - Fork 642
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
[BUG] fix AttributeError: 'ExperimentWriter' object has no attribute 'add_figure'
#1694
[BUG] fix AttributeError: 'ExperimentWriter' object has no attribute 'add_figure'
#1694
Conversation
…_figure' This fixes the AttributeError failure by checking that `add_figure` exists before attempting to call it. See sktime#1256
Note that I've added an additional check for Although related, it's not specifically about the linked issue. If preferred, I can create a new issue and split that off into it. |
I have not run $ pre-commit run --all-files
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Check the log at /.../.cache/pre-commit/pre-commit.log
version information
error information
|
Ah! I just realised Running it on this branch produces the following:
Which is the same result as running it on
|
Hm, question - is this an issue if Because currently, Nothing wrong with more defensive programming, but it feels like there is a larger issue to discuss about |
It impacts me with |
But that would mean the functionality is no longer available on higher lightning versions? We need to understand then the version range this issue appears on, the exact condition when it occurs, and why we are currently not seeing it in the tests: the version in the CI is I believe we are covering and executing the code in question? |
@ewth, ping - could you kindly explain the exact condition under which the issue arises that you are fixing? I cannot reproduce the error, and there does not seem to be a bug report. Update: I saw the bug report, I missed your posts there. It is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
May I request some small things:
- the
hasattr
check assumeslogger
has an attrexperiment
. Is this even always true? Given the unclear interface changes to the loggers, I would just be more defensive, and check thatlogger
hasexperiment
and that hasadd_figure
. - there is now a lot of duplicated code, not very DRY. May I suggest to move this to the base model into a function
_logger_supports(fun : str)
? Thefun
is a string that can be"add_figure"
or"add_experiment"
. For"add_figure"
, we would check both thatmatplotlib
is present, and carry out the new check.
@fkiraly I’ve been buried in work — I haven’t abandoned this, and will return to it as soon as I am able (hopefully this week sometime). |
sure, no rush. Worst case, it is very close to the finish line and a maintainer will wrap it up sometime. |
@ewth, are you still planning to wrap this up? We are approaching a new release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the requested changes now so this can go into the release. Thanks for your work, @ewth!
AttributeError: 'ExperimentWriter' object has no attribute 'add_figure'
Thanks @fkiraly! Sorry I haven't been able to get back to it, 110% of my time has been consumed of late. Keen to help out again in the (hopefully near) future when I can. I've found |
Description
This PR fixes #1256.
At present, the
AttributeError
is raised (and the script exits) if the logger used does not have theadd_figure
method.This fix adds a simple check prior to calling
add_figure
.Checklist
pre-commit install
.To run hooks independent of commit, execute
pre-commit run --all-files
Make sure to have fun coding!