Skip to content

Commit

Permalink
Pivotal ID # 184191732: Prioritize Pagetab files processing (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan-EBI authored Feb 1, 2023
1 parent 9e2c3d7 commit 4ac22f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ import ebi.ac.uk.extended.model.ExtSubmission
import ebi.ac.uk.extended.model.allFileList
import ebi.ac.uk.extended.model.allSectionsFiles

/**
* Return a sequence with all file list of a submission. Pagetab files are retrieved first, followed by section files
* and file list files.
*/
fun ExtSerializationService.fileSequence(submission: ExtSubmission): Sequence<ExtFile> {
return sequence {
for (fileList in submission.allFileList) {
fileList.file.inputStream().use { deserializeList(it).forEach { yield(it) } }
fileList.pageTabFiles.forEach { yield(it) }
}
submission.allSectionsFiles.forEach { yield(it) }
submission.pageTabFiles.forEach { yield(it) }
submission.allFileList.forEach { fileList -> fileList.pageTabFiles.forEach { yield(it) } }

submission.allSectionsFiles.forEach { yield(it) }
submission.allFileList
.map { it.file }
.forEach { it.inputStream().use { stream -> deserializeList(stream).forEach { file -> yield(file) } } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class SubmissionRequestIndexer(
private val requestService: SubmissionRequestPersistenceService,
private val filesRequestService: SubmissionRequestFilesPersistenceService,
) {
/**
* Index submission request file by creating records for each one. Note that pagetab files are processed first,
* guarantee by @see uk.ac.ebi.extended.serialization.service.ExtSerializationService.fileSequence to reduce time
* submission main/core data is not available.
*/
fun indexRequest(accNo: String, version: Int) {
val request = requestService.getPendingRequest(accNo, version)
val sub = request.submission
Expand Down

0 comments on commit 4ac22f9

Please sign in to comment.