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

refactor imports of logger dependencies #4860

Merged
merged 41 commits into from
Jan 5, 2021
Merged

Conversation

Borda
Copy link
Member

@Borda Borda commented Nov 25, 2020

What does this PR do?

Refactoring imports around optional loggers, @awaelchli
resolves partially #2266

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • 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? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

Anyone in the community is free to review the PR once the tests have passed.
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; Bugfixes should be including in bug-fix release milestones (m.f.X) and features should be included in (m.X.b) releases.

Did you have fun?

Make sure you had fun coding 🙃

@Borda Borda added feature Is an improvement or enhancement refactor logger Related to the Loggers 3rd party Related to a 3rd-party labels Nov 25, 2020
@Borda Borda added this to the 1.1 milestone Nov 25, 2020
@Borda Borda requested a review from awaelchli November 25, 2020 22:04
@Borda Borda added the help wanted Open to be worked on label Nov 25, 2020
@Borda Borda removed the help wanted Open to be worked on label Nov 26, 2020
@Borda Borda marked this pull request as ready for review November 26, 2020 12:32
@Borda Borda mentioned this pull request Nov 26, 2020
11 tasks
Comment on lines 27 to 31
from pytorch_lightning.loggers.comet import COMET_AVAILABLE, CometLogger
from pytorch_lightning.loggers.mlflow import MLFLOW_AVAILABLE, MLFlowLogger
from pytorch_lightning.loggers.neptune import NEPTUNE_AVAILABLE, NeptuneLogger
from pytorch_lightning.loggers.test_tube import TESTTUBE_AVAILABLE, TestTubeLogger
from pytorch_lightning.loggers.wandb import WANDB_AVAILABLE, WandbLogger
Copy link
Member Author

@Borda Borda Nov 26, 2020

Choose a reason for hiding this comment

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

I guess alco this one split per logger, right? @tchaton @SeanNaren
even this one is too large :]

@Borda Borda added the priority: 1 Medium priority task label Nov 26, 2020
@Borda
Copy link
Member Author

Borda commented Nov 26, 2020

@awaelchli do you have suggestions why the mocking tests for loggers are failing?

pytorch_lightning/loggers/wandb.py Outdated Show resolved Hide resolved
pytorch_lightning/loggers/wandb.py Outdated Show resolved Hide resolved
@Borda Borda modified the milestones: 1.1, 1.1.x Nov 30, 2020
@mergify mergify bot requested a review from a team December 12, 2020 14:58
@Borda Borda force-pushed the refactor/imports-loggers branch from 0a58bd1 to b8ad06c Compare December 17, 2020 09:09
@Borda
Copy link
Member Author

Borda commented Dec 17, 2020

@awaelchli it seems to be still falling, so far I see it seems that with mocking we cannot use the actual _module_available so not sure what would be better if the func also accepts mock packages, but then it degrades the functions or redoes logger mocking...
Well, an alternative would be to add extra arg to the _module_available(..., strict: bool = True) and with not strict it would also, work with mocked packages... What do you think?

@awaelchli
Copy link
Contributor

so far I see it seems that with mocking we cannot use the actual _module_available so not sure what would be better if the func also accepts mock packages, but then it degrades the functions or redoes logger mocking.

of course it can :)
you deleted some lines, that's why tests couldn't mock the experiment objects. See my commits, I reverted it and now it should be working.

You can test this also locally, all you have to do is uninstall the loggers (pip uninstall wandb, for example) and then run the tests and they should still pass.

@Borda Borda force-pushed the refactor/imports-loggers branch from 4eb387a to c360fa8 Compare December 20, 2020 07:25
@codecov
Copy link

codecov bot commented Jan 1, 2021

Codecov Report

Merging #4860 (2706064) into master (410d67f) will increase coverage by 0%.
The diff coverage is 98%.

@@          Coverage Diff           @@
##           master   #4860   +/-   ##
======================================
  Coverage      93%     93%           
======================================
  Files         134     134           
  Lines        9976    9992   +16     
======================================
+ Hits         9294    9309   +15     
- Misses        682     683    +1     

@Borda
Copy link
Member Author

Borda commented Jan 1, 2021

@awaelchli mind recheck? 🐰

@Borda Borda enabled auto-merge (squash) January 1, 2021 21:56
@Borda Borda added the ready PRs ready to be merged label Jan 1, 2021
@Borda Borda requested a review from tchaton January 2, 2021 11:07
.github/workflows/ci_test-conda.yml Outdated Show resolved Hide resolved
pytorch_lightning/loggers/__init__.py Show resolved Hide resolved
pytorch_lightning/loggers/comet.py Show resolved Hide resolved
pytorch_lightning/loggers/mlflow.py Show resolved Hide resolved
pytorch_lightning/loggers/wandb.py Show resolved Hide resolved
@Borda Borda requested a review from tchaton January 4, 2021 07:55
.github/workflows/ci_test-base.yml Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@Borda Borda requested a review from edenlightning January 5, 2021 19:09
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@rohitgr7 rohitgr7 left a comment

Choose a reason for hiding this comment

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

looks like some tests are failing on master.

tests/loggers/test_mlflow.py Show resolved Hide resolved
@Borda Borda merged commit ec0fb7a into master Jan 5, 2021
@Borda Borda deleted the refactor/imports-loggers branch January 5, 2021 19:34
@Borda
Copy link
Member Author

Borda commented Jan 5, 2021

looks like some tests are failing on master.

yes, but the last commit here touching code b2cbf7c is fine...

Borda added a commit that referenced this pull request Jan 6, 2021
* refactor imports of logger dependencies

* fix

* fix

* fix

* name

* fix

* mocks

* fix tests

* fix mlflow

* fix test tube

* fix wandb import check

* whitespace

* name

* name

* hack

* hack

* rev

* fix

* update mlflow import check

* try without installing conda dep

* .

* .

* .

* .

* .

* .

* .

* .

* .

Co-authored-by: Adrian Wälchli <[email protected]>
Co-authored-by: Adrian Wälchli <[email protected]>

(cherry picked from commit ec0fb7a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Related to a 3rd-party feature Is an improvement or enhancement logger Related to the Loggers priority: 1 Medium priority task ready PRs ready to be merged refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants