-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 direct path code path #30764
Add direct path code path #30764
Changes from 10 commits
df46ff9
4aef673
96bf741
952a01c
17c063b
a2edf60
af4f202
6c7b399
6791c75
f8732c8
e60cb1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -257,3 +257,4 @@ checkstyleMain.enabled = false | |
checkstyleTest.enabled = false | ||
//TODO(https://github.com/apache/beam/issues/19119): javadoc task should be enabled in the future. | ||
javadoc.enabled = false | ||
test.outputs.upToDateWhen {false} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ public DataflowWorkProgressUpdater( | |
super(worker, Integer.MAX_VALUE); | ||
this.workItemStatusClient = workItemStatusClient; | ||
this.workItem = workItem; | ||
this.hotKeyLogger = new HotKeyLogger(); | ||
this.hotKeyLogger = HotKeyLogger.ofSystemClock(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can cleanups be moved to separate PRs? Less churn if things are reverted and easier to review and summarize with commit description. |
||
this.options = options; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,30 +18,41 @@ | |
package org.apache.beam.runners.dataflow.worker; | ||
|
||
import com.google.api.client.util.Clock; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.concurrent.NotThreadSafe; | ||
import org.apache.beam.runners.dataflow.util.TimeUtil; | ||
import org.apache.beam.sdk.annotations.Internal; | ||
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.annotations.VisibleForTesting; | ||
import org.joda.time.Duration; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@NotThreadSafe | ||
scwhittle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@Internal | ||
public class HotKeyLogger { | ||
private final Logger LOG = LoggerFactory.getLogger(HotKeyLogger.class); | ||
|
||
/** Clock used to either provide real system time or mocked to virtualize time for testing. */ | ||
private Clock clock = Clock.SYSTEM; | ||
|
||
private final Clock clock; | ||
/** Throttles logging the detection to every loggingPeriod */ | ||
private final Duration loggingPeriod = Duration.standardMinutes(5); | ||
/** | ||
* The previous time the HotKeyDetection was logged. This is used to throttle logging to every 5 | ||
* minutes. | ||
*/ | ||
private long prevHotKeyDetectionLogMs = 0; | ||
|
||
/** Throttles logging the detection to every loggingPeriod */ | ||
private final Duration loggingPeriod = Duration.standardMinutes(5); | ||
private HotKeyLogger(Clock clock) { | ||
this.clock = clock; | ||
} | ||
|
||
HotKeyLogger() {} | ||
public static HotKeyLogger ofSystemClock() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just name create? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
return new HotKeyLogger(Clock.SYSTEM); | ||
} | ||
|
||
HotKeyLogger(Clock clock) { | ||
this.clock = clock; | ||
@VisibleForTesting | ||
static HotKeyLogger forTesting(Clock testClock) { | ||
return new HotKeyLogger(testClock); | ||
} | ||
|
||
/** Logs a detection of the hot key every 5 minutes. */ | ||
|
@@ -62,7 +73,7 @@ public void logHotKeyDetection(String userStepName, Duration hotKeyAge) { | |
} | ||
|
||
/** Logs a detection of the hot key every 5 minutes with the given key. */ | ||
public void logHotKeyDetection(String userStepName, Duration hotKeyAge, Object hotkey) { | ||
public void logHotKeyDetection(String userStepName, Duration hotKeyAge, @Nullable Object hotkey) { | ||
if (isThrottled()) { | ||
return; | ||
} | ||
|
@@ -80,7 +91,8 @@ public void logHotKeyDetection(String userStepName, Duration hotKeyAge, Object h | |
* Returns true if the class should log the HotKeyMessage. This method throttles logging to every | ||
* 5 minutes. | ||
*/ | ||
protected boolean isThrottled() { | ||
@VisibleForTesting | ||
boolean isThrottled() { | ||
// Throttle logging the HotKeyDetection to every 5 minutes. | ||
long nowMs = clock.currentTimeMillis(); | ||
if (nowMs - prevHotKeyDetectionLogMs < loggingPeriod.getMillis()) { | ||
|
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.
unbounded is confusing with bounded/unbounded pcollection.
How about workerMetricsLogger if it is metrics not scoped to a step?
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