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

Fix TrainsLogger doctest failing (switch to bypass mode in GitHub CI) #1379

Merged
merged 16 commits into from
Apr 8, 2020

Conversation

bmartinn
Copy link
Contributor

@bmartinn bmartinn commented Apr 4, 2020

Fix TrainsLogger CI doctests failing
See PR #1352 and allegroai/clearml#119

TrainsLogger run in offline (bypass-mode) automatically on GitHub CI doctest.

@mergify mergify bot requested a review from a team April 4, 2020 18:53
@codecov
Copy link

codecov bot commented Apr 4, 2020

Codecov Report

Merging #1379 into master will decrease coverage by 1%.
The diff coverage is 50%.

@@          Coverage Diff           @@
##           master   #1379   +/-   ##
======================================
- Coverage      92%     91%   -1%     
======================================
  Files          63      63           
  Lines        3336    3321   -15     
======================================
- Hits         3061    3025   -36     
- Misses        275     296   +21     

Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

this fix is just for the two CI, but what about other users running test offline?

self._trains = None
print('TRAINS Task: running in bypass mode')
Copy link
Member

Choose a reason for hiding this comment

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

use rather a logger from pytorch_lightning import _logger as log

Copy link
Contributor Author

@bmartinn bmartinn Apr 4, 2020

Choose a reason for hiding this comment

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

I'm using "print" to match the behavior of Trains, otherwise the doctest will not match the expected behavior outside of CI testing, don't you think?

@Borda what do you think? If I'll use logging it will break the doctest again, unless we change the documentation (which I'm okay with) ...


:return: If True, all outside communication is skipped
"""
return cls._bypass if cls._bypass is not None else \
Copy link
Member

Choose a reason for hiding this comment

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

but this will still fail if a contributor will run it locally without connection, right?

Copy link
Contributor Author

@bmartinn bmartinn Apr 4, 2020

Choose a reason for hiding this comment

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

Yes working on CI failing
I'm using "print" to match the behavior of Trains, otherwise the doctest will not match the expected behavior outside of CI testing, don't you think?

Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to doctest the print statements? Perhaps it is enough to just test the instantiation? Anyway I think having the doctest is already very nice :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@awaelchli the print is to match the expected behavior, so users know what to excepted when everything is working correctly. That said the actual text is printed (stdout) inside Trains package, so my goal was that CI process imitates the Trains prints.
@Borda what do you think? If I'll use logging it will break the doctest again, unless we change the documentation (which I'm okay with) ...

p.s.
CI finally passing, all in bypass mode

Copy link
Member

Choose a reason for hiding this comment

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

oh right, these prints are the package itself. ok sry :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Borda @williamFalcon again my apologies for not realizing the doctest are executed as part of the CI (after seeing it, I can definitely relate to how annoying tests failing is).
Also, while debugging the CI pipelines I found that the same doctests are executed by three different pipelines: GitHub workflow, Circle, and Drone. Not sure if it is on purpose, but just fyi...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but this will still fail if a contributor will run it locally without connection, right?

If users use the TrainsLogger without a connection the Trains package will output an error (it has to have a connection)
That said bypass mode is still supported with:

TrainsLogger.set_bypass_mode(True)

@Borda Borda added the ci Continuous Integration label Apr 4, 2020
@bmartinn
Copy link
Contributor Author

bmartinn commented Apr 4, 2020

this fix is just for the two CI, but what about other users running test offline?

This is still supported with:

TrainsLogger.set_bypass_mode(True)

@williamFalcon
Copy link
Contributor

This PR drops coverage though. Can we fix that?

Copy link
Contributor

@williamFalcon williamFalcon left a comment

Choose a reason for hiding this comment

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

Mind making sure this doesn't drop coverage?

@bmartinn
Copy link
Contributor Author

bmartinn commented Apr 5, 2020

Guys, the "Build-Docs" started failing, yesterday it passed on the exact same code base.
Did something change in the CI ?

@awaelchli
Copy link
Member

awaelchli commented Apr 5, 2020

It looks like sphinx got a new release but one of the extensions is not ready for that.
A temporary fix is to change sphinx>=2.0 to sphinx<3.0 in docs/requirements.txt
@Borda what do you think?

@jeremyjordan
Copy link
Contributor

@awaelchli yes i think as a general rule we should pin versions to prevent upgrading major releases without explicit review

sphinx>=2.0,<3.0

@williamFalcon
Copy link
Contributor

@Borda how do you run the codecov bot again?

@Borda
Copy link
Member

Borda commented Apr 6, 2020

@Borda how do you run the codecov bot again?

you need to re-run Drone CI because only this one is sending the report

@bmartinn
Copy link
Contributor Author

bmartinn commented Apr 6, 2020

@Borda How do I do that (re-run Drone CI) ?
edit:
I pushed the final #1382 merge, maybe it will trigger it?!
edit 2:
Seems to have no effect, @Borda do you think it has something to do with the fact that when I click on the codecov PR link I get a forbidden page and a request to login (that was not there yesterday...)

@bmartinn
Copy link
Contributor Author

bmartinn commented Apr 7, 2020

Guys, I still can't detect any change in Codecov, is it just me? (The decrease in coverage was due to the CI bypass mode, I think I manage to tell Codecov to ignore it, but I'm uncertain...)

Edit:
@Borda , seems like the doc build fell on connection issue, I imagine rerunning it will solve it.

@bmartinn bmartinn requested a review from Borda April 7, 2020 23:45
@bmartinn
Copy link
Contributor Author

bmartinn commented Apr 7, 2020

@williamFalcon I can't get the Codecov bot to update the new coverage but on the drone log it seems to stay 92% (i.e. no change)
See testing section log here

@williamFalcon williamFalcon merged commit fb8d085 into Lightning-AI:master Apr 8, 2020
@bmartinn bmartinn deleted the fix_doctest_trainslogger branch April 8, 2020 23:10
tullie pushed a commit to tullie/pytorch-lightning that referenced this pull request Jun 7, 2020
…Lightning-AI#1379)

* Fix TrainsLogger doctest failing (switch to bypass mode in GitHub CI)

* fix

* test ci

* debug

* debug CI

* Fix CircleCI

* Fix Any CI environment switch to bypass mode

* Removed debug prints

* Improve code coverage

* Improve code coverage

* Reverted

* Improve code coverage

* Test CI

* test codecov

* Codecov fix

* remove pragma

Co-authored-by: bmartinn <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants