Skip to content

Commit

Permalink
Set job run ID in ingest job events
Browse files Browse the repository at this point in the history
  • Loading branch information
patchwork01 committed Feb 20, 2025
1 parent f68fcab commit 7d448cf
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ public class IngestJobAddedFilesEvent implements IngestJobEvent {
private final int fileCount;

private IngestJobAddedFilesEvent(Builder builder) {
this.jobId = Objects.requireNonNull(builder.jobId, "jobId must not be null");
this.tableId = Objects.requireNonNull(builder.tableId, "tableId must not be null");
this.jobRunId = builder.jobRunId;
this.taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
this.writtenTime = Objects.requireNonNull(builder.writtenTime, "writtenTime must not be null");
this.fileCount = builder.fileCount;
jobId = Objects.requireNonNull(builder.jobId, "jobId must not be null");
tableId = Objects.requireNonNull(builder.tableId, "tableId must not be null");
jobRunId = Objects.requireNonNull(builder.jobRunId, "jobRunId must not be null");
taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
writtenTime = Objects.requireNonNull(builder.writtenTime, "writtenTime must not be null");
fileCount = builder.fileCount;
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public class IngestJobFailedEvent implements IngestJobEvent {
private final List<String> failureReasons;

private IngestJobFailedEvent(Builder builder) {
this.jobId = builder.jobId;
this.tableId = builder.tableId;
this.jobRunId = builder.jobRunId;
this.taskId = builder.taskId;
this.failureTime = builder.failureTime;
this.failureReasons = builder.failureReasons;
jobId = Objects.requireNonNull(builder.jobId, "jobId must not be null");
tableId = Objects.requireNonNull(builder.tableId, "tableId must not be null");
jobRunId = Objects.requireNonNull(builder.jobRunId, "jobRunId must not be null");
taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
failureTime = builder.failureTime;
failureReasons = builder.failureReasons;
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@
public class IngestJobFinishedEvent implements IngestJobEvent {
private final String jobId;
private final String tableId;
private final String jobRunId;
private final String taskId;
private final JobRunSummary summary;
private final int numFilesWrittenByJob;
private final boolean committedBySeparateFileUpdates;
private final String jobRunId;
private final String taskId;

private IngestJobFinishedEvent(Builder builder) {
jobId = Objects.requireNonNull(builder.jobId, "jobId must not be null");
tableId = Objects.requireNonNull(builder.tableId, "tableId must not be null");
jobRunId = Objects.requireNonNull(builder.jobRunId, "jobRunId must not be null");
taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
summary = Objects.requireNonNull(builder.summary, "summary must not be null");
numFilesWrittenByJob = Objects.requireNonNull(builder.numFilesWrittenByJob, "numFilesWrittenByJob must not be null");
committedBySeparateFileUpdates = builder.committedBySeparateFileUpdates;
jobRunId = builder.jobRunId;
taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
}

public static Builder builder() {
Expand All @@ -59,6 +59,14 @@ public String getTableId() {
return tableId;
}

public String getJobRunId() {
return jobRunId;
}

public String getTaskId() {
return taskId;
}

public Instant getFinishTime() {
return summary.getFinishTime();
}
Expand All @@ -75,14 +83,6 @@ public boolean isCommittedBySeparateFileUpdates() {
return committedBySeparateFileUpdates;
}

public String getJobRunId() {
return jobRunId;
}

public String getTaskId() {
return taskId;
}

@Override
public int hashCode() {
return Objects.hash(jobId, tableId, summary, numFilesWrittenByJob, committedBySeparateFileUpdates, jobRunId, taskId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@
public class IngestJobStartedEvent implements IngestJobEvent {
private final String jobId;
private final String tableId;
private final int fileCount;
private final String jobRunId;
private final String taskId;
private final int fileCount;
private final Instant startTime;
private final boolean startOfRun;

private IngestJobStartedEvent(Builder builder) {
jobId = Objects.requireNonNull(builder.jobId, "jobId must not be null");
tableId = Objects.requireNonNull(builder.tableId, "tableId must not be null");
fileCount = builder.fileCount;
jobRunId = builder.jobRunId;
jobRunId = Objects.requireNonNull(builder.jobRunId, "jobRunId must not be null");
taskId = Objects.requireNonNull(builder.taskId, "taskId must not be null");
fileCount = builder.fileCount;
startTime = Objects.requireNonNull(builder.startTime, "startTime must not be null");
startOfRun = builder.startOfRun;
}
Expand All @@ -53,10 +53,6 @@ public String getTableId() {
return tableId;
}

public int getFileCount() {
return fileCount;
}

public String getJobRunId() {
return jobRunId;
}
Expand All @@ -65,6 +61,10 @@ public String getTaskId() {
return taskId;
}

public int getFileCount() {
return fileCount;
}

public Instant getStartTime() {
return startTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private IngestJobEventTestData() {
public static IngestJobStartedEvent.Builder ingestJobStartedEventBuilder(Instant startTime) {
return IngestJobStartedEvent.builder()
.jobId(UUID.randomUUID().toString())
.jobRunId(UUID.randomUUID().toString())
.tableId(DEFAULT_TABLE_ID)
.fileCount(1)
.startTime(startTime)
Expand All @@ -61,6 +62,7 @@ public static IngestJobStartedEvent.Builder ingestJobStartedEventBuilder(Instant
public static IngestJobStartedEvent.Builder ingestJobStartedAfterValidationEventBuilder(IngestJobValidatedEvent validatedEvent, Instant startTime) {
return IngestJobStartedEvent.builder()
.jobId(validatedEvent.getJobId())
.jobRunId(validatedEvent.getJobRunId())
.tableId(validatedEvent.getTableId())
.fileCount(validatedEvent.getFileCount())
.startTime(startTime)
Expand Down Expand Up @@ -97,6 +99,7 @@ public static IngestJobValidatedEvent.Builder ingestJobAcceptedEventBuilder(Inst
public static IngestJobValidatedEvent.Builder ingestJobValidatedEventBuilder(Instant validationTime) {
return IngestJobValidatedEvent.builder()
.jobId(UUID.randomUUID().toString())
.jobRunId(UUID.randomUUID().toString())
.tableId(DEFAULT_TABLE_ID)
.validationTime(validationTime);
}
Expand Down

0 comments on commit 7d448cf

Please sign in to comment.