-
Notifications
You must be signed in to change notification settings - Fork 242
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
Add a reset() method to ProgressLoggerInterface. #1184
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1184 +/- ##
==============================================
+ Coverage 68.4% 68.409% +0.009%
- Complexity 8014 8016 +2
==============================================
Files 541 542 +1
Lines 32690 32693 +3
Branches 5529 5529
==============================================
+ Hits 22360 22365 +5
+ Misses 8126 8125 -1
+ Partials 2204 2203 -1
|
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.
LGTM. Let's give @jacarey and @lbergelson some time to weigh in, but if they don't object I'll merge this in a day or two.
This seems fine, it is a breaking API change which is gross, but I suspect the only downstream implementer of ProgressLogger is the GATK so it's probably not a huge deal in practice. It feel like maybe this is a problem better solved by just creating it when it's needed, but maybe there's some good use for it that I'm not seeing. |
If you're worried about the breaking API change we could ask @nh13 to add a default no-op implementation of |
|
@@ -124,6 +124,16 @@ public boolean record(final SAMRecord... recs) { | |||
/** Returns the number of seconds since progress tracking began. */ | |||
public long getElapsedSeconds() { return (System.currentTimeMillis() - this.startTime) / 1000; } | |||
|
|||
/** Resets the start time to now and the number of records to zero. */ |
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.
In general, you want the javadoc on the baseclass or interface, so it's inherited by all subclassers and so a user can see the javadoc when dealing with the interface type.
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.
Agreed, but I am going to pass on this change to be consistent with how ProgressLoggerInterface
currently is written.
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 agree with @pshapiro4broad but lets handle that separately.
I certainly can create the object right before it's used most of the time (I could use lazy in scala), but sometimes, there may be an initial delay from creation time to when the first record (and subsequent records) start processing that I don't want to affect the start time. The alternative I was considering was having a way to configure |
@nh13 This seems like a fine solution, setting it when you record the first record is usually alright, but it has a similar issue to setting it at construction time if for some reason the first record is unusually slow or if you only have a few long operations being recorded. 👍 to this change with the default method. |
I have two uses for this method:
ProgressLogger
earlier, but want to set thestartTime
so it is right before the logger is being used. Yes, I can create theProgressLogger
at the last minute.