phet commented on code in PR #3912:
URL: https://github.com/apache/gobblin/pull/3912#discussion_r1562858949


##########
gobblin-temporal/src/main/java/org/apache/gobblin/temporal/ddm/activity/impl/CommitActivityImpl.java:
##########
@@ -87,12 +97,19 @@ public int commit(WUProcessingSpec workSpec) {
         return 0;
       }
       Queue<TaskState> taskStateQueue = taskStateQueueOpt.get();
-      commitTaskStates(jobState, ImmutableList.copyOf(taskStateQueue), 
globalGobblinContext);
+      Map<String, JobState.DatasetState> datasetStatesByUrns = 
createDatasetStatesByUrns(ImmutableList.copyOf(taskStateQueue));
+      commitTaskStates(jobState, datasetStatesByUrns, globalGobblinContext, 
jobNameOpt);
+      List<DatasetTaskSummary> datasetTaskSummaries = 
generateDatasetTaskSummaries(datasetStatesByUrns, globalGobblinContext, 
workSpec.getEventSubmitterContext().create());
+      // Submit event that summarizes work done
+      TemporalEventTimer.Factory timerFactory = new 
TemporalEventTimer.Factory(workSpec.getEventSubmitterContext());
+      TemporalEventTimer eventTimer = 
timerFactory.create(TimingEvent.LauncherTimings.JOB_SUMMARY);

Review Comment:
   shall we streamline?  what do you think about:
   ```
   TemporalEventTimer eventTimer = 
TemporalEventTimer.Factory.createEvent(workSpec.getEventSubmitterContext(), 
TimingEvent.LauncherTimings.JOB_SUMMARY);
   ```
   ?
   
   personally, I'd prefer a more fluent API, to support:
   ```
   TemporalEventTimer.Factory.createEvent(workSpec.getEventSubmitterContext(), 
TimingEvent.LauncherTimings.JOB_SUMMARY)
       .withMetadata(TimingEvent.DATASET_TASK_SUMMARIES, 
GsonUtils.GSON_WITH_DATE_HANDLING.toJson(datasetTaskSummaries))
       .submit();
   ```
   for that, we'd just need:
   a. either to change the `addMetadata` return type to support chaining or 
else introduce a `withMetadata` alt. version that does
   b. alias `stop()` to `submit()`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to