Skip to content

Conversation

@awaelchli
Copy link
Contributor

@awaelchli awaelchli commented May 31, 2021

What does this PR do?

Fixes #7778

Fixes incorrect formatting of time remaining.
Now shows a message properly formatted:

Time limit reached. Elapsed time is 0:00:03. Signaling Trainer to stop.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • 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?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or internal minor changes/refactorings)

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

Did you have fun?

Make sure you had fun coding 🙃

@awaelchli awaelchli added the bug Something isn't working label May 31, 2021
@codecov
Copy link

codecov bot commented May 31, 2021

Codecov Report

Merging #7780 (0304d65) into master (d47173b) will decrease coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #7780   +/-   ##
======================================
- Coverage      93%     92%   -0%     
======================================
  Files         199     199           
  Lines       12985   12986    +1     
======================================
- Hits        12018   11981   -37     
- Misses        967    1005   +38     

@awaelchli awaelchli force-pushed the bugfix/timer-elapsed branch from ca5934b to d5ce796 Compare May 31, 2021 11:35
@awaelchli awaelchli added this to the v1.3.x milestone May 31, 2021
@awaelchli awaelchli changed the title call time_elapsed Fix info message when max training time reached May 31, 2021
@awaelchli awaelchli changed the title Fix info message when max training time reached fix info message when max training time reached May 31, 2021
@awaelchli awaelchli marked this pull request as ready for review May 31, 2021 11:43
@awaelchli awaelchli added the ready PRs ready to be merged label May 31, 2021
@justusschock justusschock enabled auto-merge (squash) May 31, 2021 12:42
@justusschock justusschock merged commit 7e6010f into master May 31, 2021
@justusschock justusschock deleted the bugfix/timer-elapsed branch May 31, 2021 12:50
Comment on lines +113 to +114
assert "Time limit reached." in caplog.text
assert "Signaling Trainer to stop." in caplog.text
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert "Time limit reached." in caplog.text
assert "Signaling Trainer to stop." in caplog.text
assert re.match(r"Time limit reached. Elapsed time is .*\. Signaling Trainer to stop.", caplog.text)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@justusschock mind rather use reg expresions?

Copy link
Member

Choose a reason for hiding this comment

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

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 it wouldn't work.

Not even

assert re.match(r".*Time limit reached.*", caplog.text)

wants to match.

Copy link
Collaborator

Choose a reason for hiding this comment

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

import re
m = "Time limit reached. Elapsed time is any text here I want. Signaling Trainer to stop."
assert re.match(r"Time limit reached. Elapsed time is .*\. Signaling Trainer to stop.", m)

or what is in the caplog.text?

@tchaton tchaton mentioned this pull request Jun 1, 2021
tchaton pushed a commit that referenced this pull request Jun 1, 2021
* call time_elapsed

* elapsed formatting

* format

* update test

* changelog
Borda pushed a commit that referenced this pull request Jun 1, 2021
* call time_elapsed

* elapsed formatting

* format

* update test

* changelog
tchaton pushed a commit that referenced this pull request Jun 1, 2021
* call time_elapsed

* elapsed formatting

* format

* update test

* changelog
lexierule pushed a commit that referenced this pull request Jun 1, 2021
* call time_elapsed

* elapsed formatting

* format

* update test

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elapsed time not shown correctly when max_time is reached

5 participants