Will-Lo commented on code in PR #3667:
URL: https://github.com/apache/gobblin/pull/3667#discussion_r1160923357
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/AbstractJobLauncher.java:
##########
@@ -728,6 +729,39 @@ protected void
postProcessTaskStates(@SuppressWarnings("unused") List<TaskState>
*/
protected void postProcessJobState(JobState jobState) {
postProcessTaskStates(jobState.getTaskStates());
+ if (!GobblinMetrics.isEnabled(this.jobProps)) {
+ return;
+ }
+ List<DatasetTaskSummary> datasetTaskSummaries = new ArrayList<>();
+ Map<String, JobState.DatasetState> datasetStates =
this.jobContext.getDatasetStatesByUrns();
+ // Only process successful datasets unless configuration to process failed
datasets is set
+ for (JobState.DatasetState datasetState : datasetStates.values()) {
+ if (datasetState.getState() == JobState.RunningState.COMMITTED
+ || (datasetState.getState() == JobState.RunningState.FAILED &&
this.jobContext.getJobCommitPolicy() ==
JobCommitPolicy.COMMIT_SUCCESSFUL_TASKS)) {
+ long totalBytesWritten = 0;
+ long totalRecordsWritten = 0;
+ for (TaskState taskState : datasetState.getTaskStates()) {
+ if ((taskState.getWorkingState() ==
WorkUnitState.WorkingState.COMMITTED
+ || PropertiesUtils.getPropAsBoolean(jobProps,
ConfigurationKeys.WRITER_COUNT_METRICS_FROM_FAILED_TASKS, "false"))
+ && taskState.contains(ConfigurationKeys.WRITER_BYTES_WRITTEN)
+ && taskState.contains(ConfigurationKeys.WRITER_RECORDS_WRITTEN))
{
+ totalBytesWritten +=
taskState.getPropAsLong(ConfigurationKeys.WRITER_BYTES_WRITTEN);
Review Comment:
In the Gobblin writer implementation it would expect both to be implemented
or neither, so I'll leave a comment that some writers omit these metrics
--
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]