-
Notifications
You must be signed in to change notification settings - Fork 244
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
Proposed replacement for progress PR #1302
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1302 +/- ##
===============================================
+ Coverage 67.644% 69.301% +1.657%
- Complexity 8188 9321 +1133
===============================================
Files 560 563 +3
Lines 33462 36757 +3295
Branches 5635 6502 +867
===============================================
+ Hits 22635 25473 +2838
- Misses 8644 8958 +314
- Partials 2183 2326 +143
|
…ates are not strictly increasing.
8c2b4de
to
4ad0ffe
Compare
this.lastStartTime = System.currentTimeMillis(); | ||
protected synchronized boolean record(final String chrom, final int pos, final String rname) { | ||
lastChrom = chrom; | ||
if (pos >= lastPos) { |
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.
only increase counter when chrom name is unchanged, and do not decrease counter.
} | ||
|
||
/** Left pads a string until it is at least the given length. */ | ||
private String pad (String in, final int length) { | ||
while (in.length() < length) { | ||
in = " " + in; | ||
final StringBuilder inBuilder = new StringBuilder(in); |
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.
preallocate the builder
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.
rewrite to avoid silliness.
@lbergelson this is ready for a review... |
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.
@yfarjoun This seems much better. A few minor comments and then 👍
private int lastPos = 0; | ||
private String lastReadName = null; | ||
private long countNonIncreasing = 0; | ||
final private long PRINT_READ_NAME_THRESHOLD = 1000; |
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.
might as well make this static
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.
sure
private String pad (String in, final int length) { | ||
while (in.length() < length) { | ||
in = " " + in; | ||
protected static String pad(final String in, final int length) { |
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.
make this default package instead of protected.
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.
done
("hello", 5, "hello"), | ||
("hello", 4, "hello"), | ||
("hello", -1, "hello")).foreach { case (in, len, expected) => | ||
AbstractProgressLogger.pad(in, len) shouldEqual expected |
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.
The formatting seems really weird here, but maybe that's scala standard?
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.
yeah.that's the default intellij formatting
This PR is a replacement for #1180. it adds the feature that the read-name printing is only turned on after the logger notices 1000 incidents where the position was decreasing.
More exactly: The logger keep a counter that increments when the position is decreasing and vice versa (but remains non-negative) If this counter is greater than 1000, the logger will also emit read-names.