Repository navigation
Adds bytes read reporting for SDF. #40639
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
base: master
Are you sure you want to change the base?
Changes from all commits
827847d
f8cdf2a
6acab49
45cde4e
293c6ac
9f6dfe8
96aa8a0
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 |
|---|---|---|
|
|
@@ -45,7 +45,6 @@ | |
| import org.apache.beam.sdk.values.TupleTag; | ||
| import org.apache.beam.sdk.values.WindowedValue; | ||
| import org.apache.beam.sdk.values.WindowingStrategy; | ||
| import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.annotations.VisibleForTesting; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| @SuppressWarnings({ | ||
|
|
@@ -138,7 +137,7 @@ protected void onStartKey() { | |
| // These elements are now processed. Register cleanup timers for all the unblocked | ||
| // windows. | ||
| helpers.registerStateCleanup( | ||
| (WindowingStrategy<?, W>) getDoFnInfo().getWindowingStrategy(), windows); | ||
| (WindowingStrategy<?, W>) helpers.fnInfo.getWindowingStrategy(), windows); | ||
| } | ||
| }); | ||
| } | ||
|
|
@@ -174,11 +173,7 @@ public void processTimers() throws Exception { | |
| // windowCoder (allowing us to get it without a DoFnInfo instance) or (2) check whether timers | ||
| // exist without actually decoding them. | ||
| Coder<BoundedWindow> windowCoder = | ||
| (Coder<BoundedWindow>) | ||
| (helpers.fnInfo != null ? helpers.fnInfo : helpers.doFnInstanceManager.peek()) | ||
| .getWindowingStrategy() | ||
| .getWindowFn() | ||
| .windowCoder(); | ||
| (Coder<BoundedWindow>) getDoFnInfo().getWindowingStrategy().getWindowFn().windowCoder(); | ||
| helpers.processTimers( | ||
| SimpleParDoFnHelpers.TimerType.FAIL_USER, | ||
| helpers.userStepContext, | ||
|
|
@@ -231,18 +226,13 @@ protected void onProcessWindowedValue(WindowedValue<KeyedWorkItem<K, InputT>> el | |
| } | ||
| if (hasState) { | ||
| helpers.registerStateCleanup( | ||
| (WindowingStrategy<?, W>) getDoFnInfo().getWindowingStrategy(), windowsProcessed); | ||
| (WindowingStrategy<?, W>) helpers.fnInfo.getWindowingStrategy(), windowsProcessed); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns the {@link DoFnInfo} currently being used by this {@link SimpleParDoFn}. | ||
| * | ||
| * <p>May be null if no element has been processed yet, or if the {@link SimpleParDoFn} has | ||
| * finished. | ||
| */ | ||
| @VisibleForTesting | ||
| @Nullable DoFnInfo<?, ?> getDoFnInfo() { | ||
| return helpers.fnInfo; | ||
| /** Returns the {@link DoFnInfo} used by this {@link StreamingKeyedWorkItemSideInputParDoFn}. */ | ||
|
Contributor
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. hmm, it appears these DoFnInfo are stateful in that they contain a DoFn which goes through the dofn lifecycle. previously we would return only the active dofninfo (or null if not processing). Now we always return one but it might not be an active one or one that is then activated in another thread. We don't want callers of getDoFnInfo to call methods that expect to just be used from the active thread (like dofn lifecycle etc). It seems like it would be cleanest if all the immutable stuff within DoFnInfo was a different interface which was returned so that getDoFnInfo couldn't be misused. |
||
| @Override | ||
| public DoFnInfo<?, ?> getDoFnInfo() throws Exception { | ||
| return helpers.fnInfo != null ? helpers.fnInfo : helpers.doFnInstanceManager.peek(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| */ | ||
| package org.apache.beam.runners.dataflow.worker.util.common.worker; | ||
|
|
||
| import org.apache.beam.sdk.util.DoFnInfo; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
|
||
| /** | ||
|
|
@@ -37,4 +38,8 @@ public interface ParDoFn { | |
| void finishBundle() throws Exception; | ||
|
|
||
| void abort() throws Exception; | ||
|
|
||
| default @Nullable DoFnInfo<?, ?> getDoFnInfo() throws Exception { | ||
| return null; | ||
|
Contributor
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. perhaps it would be better to remove the default so that new classes (and perhaps other existing ones) return an appropriate dofninfo? |
||
| } | ||
| } | ||
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.
Note I changed these to call
helpers.fnInfodirectly sincegetDoFnInfo()now potentially throwsException(fromhelpers.doFnInstanceManager.peek()). There were already instances of callinghelpers.fnInfoin this method so this seemed cleaner than adding more exception throwing.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.
maybe we should rename helpers fnInfo to activeFnInfo or something indicating it is the fninfo on the active thread?
See comment below