Skip to content

Commit

Permalink
Remove IngestJob from IngestJobAcceptedStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
patchwork01 committed Dec 18, 2024
1 parent 4e940a4 commit 42776f9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public static IngestJob createJob(int jobNum, int inputFileCount) {
}

public static IngestJobAcceptedStatus acceptedStatusUpdate(IngestJob job, Instant validationTime) {
return IngestJobAcceptedStatus.from(job, validationTime, defaultUpdateTime(validationTime));
return IngestJobAcceptedStatus.from(job.getFileCount(), validationTime, defaultUpdateTime(validationTime));
}

public static IngestJobRejectedStatus rejectedStatusUpdate(IngestJob job, Instant validationTime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package sleeper.ingest.core.job.status;

import sleeper.ingest.core.job.IngestJob;

import java.time.Instant;
import java.util.Objects;

Expand All @@ -35,18 +33,6 @@ private IngestJobAcceptedStatus(int inputFileCount, Instant validationTime, Inst
this.inputFileCount = inputFileCount;
}

/**
* Creates an instance of this class.
*
* @param job the ingest job
* @param validationTime the validation time
* @param updateTime the update time
* @return an instance of this class
*/
public static IngestJobAcceptedStatus from(IngestJob job, Instant validationTime, Instant updateTime) {
return new IngestJobAcceptedStatus(job.getFiles().size(), validationTime, updateTime);
}

/**
* Creates an instance of this class.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ public static ProcessRun acceptedRunWhichStarted(
IngestJob job, String taskId, Instant validationTime, Instant startTime) {
return ProcessRun.builder()
.taskId(taskId)
.startedStatus(IngestJobAcceptedStatus.from(job,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(),
validationTime, defaultUpdateTime(validationTime)))
.statusUpdate(
IngestJobStartedStatus.withStartOfRun(false)
.inputFileCount(job.getFiles().size())
.inputFileCount(job.getFileCount())
.startTime(startTime).updateTime(defaultUpdateTime(startTime)).build())
.build();
}
Expand All @@ -162,11 +162,11 @@ public static ProcessRun acceptedRunWhichFinished(
IngestJob job, String taskId, Instant validationTime, RecordsProcessedSummary summary, int numFilesWrittenByJob) {
return ProcessRun.builder()
.taskId(taskId)
.startedStatus(IngestJobAcceptedStatus.from(job,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(),
validationTime, defaultUpdateTime(validationTime)))
.statusUpdate(
IngestJobStartedStatus.withStartOfRun(false)
.inputFileCount(job.getFiles().size())
.inputFileCount(job.getFileCount())
.startTime(summary.getStartTime())
.updateTime(defaultUpdateTime(summary.getStartTime())).build())
.finishedStatus(IngestJobFinishedStatus
Expand All @@ -189,11 +189,11 @@ public static ProcessRun acceptedRunWhichFailed(
IngestJob job, String taskId, Instant validationTime, ProcessRunTime runTime, List<String> failureReasons) {
return ProcessRun.builder()
.taskId(taskId)
.startedStatus(IngestJobAcceptedStatus.from(job,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(),
validationTime, defaultUpdateTime(validationTime)))
.statusUpdate(
IngestJobStartedStatus.withStartOfRun(false)
.inputFileCount(job.getFiles().size())
.inputFileCount(job.getFileCount())
.startTime(runTime.getStartTime())
.updateTime(defaultUpdateTime(runTime.getStartTime())).build())
.finishedStatus(ProcessFailedStatus
Expand All @@ -210,7 +210,7 @@ validationTime, defaultUpdateTime(validationTime)))
*/
public static ProcessRun acceptedRun(IngestJob job, Instant validationTime) {
return ProcessRun.builder()
.startedStatus(IngestJobAcceptedStatus.from(job,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(),
validationTime, defaultUpdateTime(validationTime)))
.build();
}
Expand All @@ -227,7 +227,7 @@ validationTime, defaultUpdateTime(validationTime)))
public static ProcessRun acceptedRunOnTask(IngestJob job, String taskId, Instant validationTime) {
return ProcessRun.builder()
.taskId(taskId)
.startedStatus(IngestJobAcceptedStatus.from(job, validationTime,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(), validationTime,
defaultUpdateTime(validationTime)))
.build();
}
Expand Down Expand Up @@ -377,7 +377,7 @@ public static ProcessRun failedIngestRun(
public static ProcessRun acceptedAndFailedToStartIngestRun(
IngestJob job, Instant validationTime, Instant failureTime, List<String> failureReasons) {
return ProcessRun.builder()
.startedStatus(IngestJobAcceptedStatus.from(job,
.startedStatus(IngestJobAcceptedStatus.from(job.getFileCount(),
validationTime, defaultUpdateTime(validationTime)))
.finishedStatus(ProcessFailedStatus.timeAndReasons(
defaultUpdateTime(failureTime), new ProcessRunTime(failureTime, Duration.ZERO), failureReasons))
Expand Down Expand Up @@ -417,7 +417,7 @@ public static IngestJobStatus singleJobStatusFrom(TestProcessStatusUpdateRecords
* @return an ingest job accepted status
*/
public static IngestJobAcceptedStatus ingestAcceptedStatus(IngestJob job, Instant validationTime) {
return IngestJobAcceptedStatus.from(job, validationTime, defaultUpdateTime(validationTime));
return IngestJobAcceptedStatus.from(job.getFileCount(), validationTime, defaultUpdateTime(validationTime));
}

/**
Expand Down

0 comments on commit 42776f9

Please sign in to comment.