[
https://issues.apache.org/jira/browse/BEAM-6233?focusedWorklogId=179212&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-179212
]
ASF GitHub Bot logged work on BEAM-6233:
----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Dec/18 19:59
Start Date: 27/Dec/18 19:59
Worklog Time Spent: 10m
Work Description: Ardagan commented on pull request #7330: [BEAM-6233]:
Add initial user timer support in Dataflow for batch pipelines
URL: https://github.com/apache/beam/pull/7330#discussion_r244213542
##########
File path:
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/fn/control/ProcessRemoteBundleOperation.java
##########
@@ -48,25 +61,98 @@
new OutputReceiverFactory() {
@Override
public FnDataReceiver<?> create(String pCollectionId) {
- return receivedElement -> {
- LOG.debug("Consume element {}", receivedElement);
- outputReceiverMap.get(pCollectionId).process((WindowedValue<?>)
receivedElement);
- };
+ return receivedElement -> receive(pCollectionId, receivedElement);
}
};
private final StateRequestHandler stateRequestHandler;
private final BundleProgressHandler progressHandler;
private RemoteBundle remoteBundle;
+ private final DataflowExecutionContext<?> executionContext;
+ private final Map<String, ProcessBundleDescriptors.TimerSpec>
timerOutputIdToSpecMap;
+ private final Map<String, Coder<BoundedWindow>> timerWindowCodersMap;
+ private final Map<String, ProcessBundleDescriptors.TimerSpec>
timerIdToTimerSpecMap;
+ private final Map<String, Object> timerIdToKey;
+ private ExecutableStage executableStage;
public ProcessRemoteBundleOperation(
- OperationContext context,
+ ExecutableStage executableStage,
+ DataflowExecutionContext<?> executionContext,
+ DataflowOperationContext operationContext,
StageBundleFactory stageBundleFactory,
Map<String, OutputReceiver> outputReceiverMap) {
- super(EMPTY_RECEIVER_ARRAY, context);
+ super(EMPTY_RECEIVER_ARRAY, operationContext);
+
this.stageBundleFactory = stageBundleFactory;
- this.outputReceiverMap = outputReceiverMap;
this.stateRequestHandler = StateRequestHandler.unsupported();
this.progressHandler = BundleProgressHandler.ignored();
+ this.executionContext = executionContext;
+ this.timerOutputIdToSpecMap = new HashMap<>();
+ this.timerWindowCodersMap = new HashMap<>();
+ this.executableStage = executableStage;
+ this.timerIdToKey = new HashMap<>();
+ this.outputReceiverMap = outputReceiverMap;
+ timerIdToTimerSpecMap = new HashMap<>();
+
+ for (Map<String, ProcessBundleDescriptors.TimerSpec> transformTimerMap :
+
stageBundleFactory.getProcessBundleDescriptor().getTimerSpecs().values()) {
+ for (ProcessBundleDescriptors.TimerSpec timerSpec :
transformTimerMap.values()) {
+ timerIdToTimerSpecMap.put(timerSpec.timerId(), timerSpec);
+ }
+ }
+
+ for (Map<String, ProcessBundleDescriptors.TimerSpec> transformTimerMap :
+
stageBundleFactory.getProcessBundleDescriptor().getTimerSpecs().values()) {
+ for (ProcessBundleDescriptors.TimerSpec timerSpec :
transformTimerMap.values()) {
+ timerOutputIdToSpecMap.put(timerSpec.outputCollectionId(), timerSpec);
+ }
+ }
+
+ for (RunnerApi.PTransform pTransform :
+ stageBundleFactory
+ .getProcessBundleDescriptor()
+ .getProcessBundleDescriptor()
+ .getTransformsMap()
+ .values()) {
+ for (String timerId : timerIdToTimerSpecMap.keySet()) {
+ if (!pTransform.getInputsMap().containsKey(timerId)) {
Review comment:
I'd suggest to split this method into two:
one for filling timerOutputIdToSpecMap
and other one for fillingtimerWindowCodersMap
Minimum request is to extract contents of this loop into separate method. It
is too long and hard to track when reading. Giving it descriptive name (and
probably method comment) will simplify understanding of what's going on.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 179212)
Time Spent: 2h (was: 1h 50m)
> Make bundle execution with ExecutableStage support timer/states
> ---------------------------------------------------------------
>
> Key: BEAM-6233
> URL: https://issues.apache.org/jira/browse/BEAM-6233
> Project: Beam
> Issue Type: Task
> Components: runner-dataflow
> Reporter: Boyuan Zhang
> Assignee: Sam Rohde
> Priority: Major
> Time Spent: 2h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)