Logging and queing #21
@ -15,6 +15,7 @@ import se.su.dsv.seshat.repositories.FileMetadataRepository;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
@ -62,12 +63,21 @@ public class JobProcessorService {
|
||||
worker.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all jobs that have been in a processing status or pending status
|
||||
* to the queue when the application starts.
|
||||
* Ensuring that all jobs are processed even if the application is restarted
|
||||
* wihtout the user having to re-upload the files.
|
||||
*/
|
||||
@Transactional
|
||||
public void addPendingJobsToQueue() {
|
||||
List<FileMetadata> pendingJobs = fileMetadataRepository.findByJobStatus(JobStatus.PENDING);
|
||||
for (FileMetadata job : pendingJobs) {
|
||||
jobQueue.offer(job);
|
||||
}
|
||||
List<FileMetadata> processingJobs = fileMetadataRepository.findByJobStatus(JobStatus.PROCESSING);
|
||||
processingJobs.addAll(fileMetadataRepository.findByJobStatus(JobStatus.PENDING));
|
||||
|
||||
processingJobs.sort(Comparator.comparing(FileMetadata::getUploadedAt));
|
||||
|
||||
processingJobs.forEach(this::addJob);
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -47,7 +47,9 @@ public class Transcriber {
|
||||
.append(" --output_dir ")
|
||||
.append(outputDirectory)
|
||||
.append(" --device ")
|
||||
.append(selectedDevice);
|
||||
.append(selectedDevice)
|
||||
.append(" --verbose ")
|
||||
.append("False");
|
||||
if(language != null && !language.equalsIgnoreCase("auto")) {
|
||||
whisperCommandOptions.append(" --language ")
|
||||
.append(language);
|
||||
|
Loading…
x
Reference in New Issue
Block a user