Logging and queing #21
@ -15,6 +15,7 @@ import se.su.dsv.seshat.repositories.FileMetadataRepository;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
@ -62,12 +63,21 @@ public class JobProcessorService {
|
|||||||
worker.start();
|
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
|
@Transactional
|
||||||
public void addPendingJobsToQueue() {
|
public void addPendingJobsToQueue() {
|
||||||
List<FileMetadata> pendingJobs = fileMetadataRepository.findByJobStatus(JobStatus.PENDING);
|
List<FileMetadata> processingJobs = fileMetadataRepository.findByJobStatus(JobStatus.PROCESSING);
|
||||||
for (FileMetadata job : pendingJobs) {
|
processingJobs.addAll(fileMetadataRepository.findByJobStatus(JobStatus.PENDING));
|
||||||
jobQueue.offer(job);
|
|
||||||
}
|
processingJobs.sort(Comparator.comparing(FileMetadata::getUploadedAt));
|
||||||
|
|
||||||
|
processingJobs.forEach(this::addJob);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -47,7 +47,9 @@ public class Transcriber {
|
|||||||
.append(" --output_dir ")
|
.append(" --output_dir ")
|
||||||
.append(outputDirectory)
|
.append(outputDirectory)
|
||||||
.append(" --device ")
|
.append(" --device ")
|
||||||
.append(selectedDevice);
|
.append(selectedDevice)
|
||||||
|
.append(" --verbose ")
|
||||||
|
.append("False");
|
||||||
if(language != null && !language.equalsIgnoreCase("auto")) {
|
if(language != null && !language.equalsIgnoreCase("auto")) {
|
||||||
whisperCommandOptions.append(" --language ")
|
whisperCommandOptions.append(" --language ")
|
||||||
.append(language);
|
.append(language);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user