Commit 70582cb8 authored by Ihrig, Arvid Conrad (ari)'s avatar Ihrig, Arvid Conrad (ari)
Browse files

Integrated Pipeline: adjusted paths inside single-calculations HDF5 to match standard

parent 9cca0a6a
......@@ -12,11 +12,11 @@ import eu.nomad_lab.parsers.{ H5Backend, ReindexBackend }
class WriteToHDF5ResultsProcessor(outputLocation: Path, metaInfo: MetaInfoEnv) extends ParsingResultsProcessor {
override def processFileParsingResult(result: FileParsingResult): Unit = {
val id = result.task.calculationGid
val archiveGid = result.task.treeTask.archiveId
val fileName = Paths.get(id + ".h5")
val targetPath = outputLocation(result.treeTask).resolve(fileName)
Files.createDirectories(outputLocation(result.treeTask))
//VERIFY: Is this path the appropriate one for single calculation HDFs? (Is there a standard?)
val h5file = H5File.create(targetPath, Paths.get("/", id, id))
val h5file = H5File.create(targetPath, Paths.get("/", archiveGid, id))
val h5Backend = H5Backend(metaEnv = metaInfo, h5File = h5file, closeFileOnFinishedParsing = false)
val backend = new ReindexBackend(h5Backend)
try {
......
......@@ -94,6 +94,7 @@ package object integrated_pipeline_end_to_end_tests extends TestDataBuilders {
sample.candidateCalculationsWithParsers.foreach { entry =>
val task = aFileParsingTask().withTreeTask(treeTask).withRelativePath(entry._1).build()
val id = task.calculationGid
val archiveId = treeTask.archiveId
val fileName = s"$id.h5"
val targetFolder = tmpResultsFolder.resolve(treeTask.prefixFolder).resolve(treeTask.archiveId)
val location = targetFolder.resolve(fileName)
......@@ -101,7 +102,8 @@ package object integrated_pipeline_end_to_end_tests extends TestDataBuilders {
location.toFile.exists(),
s"HDF5 file '$location' with parsing results does not exist"
)
validateHDF5(targetFolder, id, metaInfo, checkSingleCalculationHDFContent(sample))
validateHDF5(targetFolder, archiveId, metaInfo, checkSingleCalculationHDFContent(sample),
Some(fileName))
}
succeed
}
......
......@@ -30,12 +30,14 @@ class WriteToHDF5ResultsProcessorSpec extends WordSpec with TestDataBuilders wit
val inputs = (1 to 3).map(x => FileParsingTask(sampleTree, Paths.get(s"file$x"), "dummyParser"))
inputs.foreach(x => writer.processFileParsingResult(createSuccessfulFileParsingResult(x)))
val targetFolder = writer.outputLocation(sampleTree)
val archiveId = sampleTree.archiveId
inputs.foreach { entry =>
val calcName = entry.calculationGid
val filePath = targetFolder.resolve(s"$calcName.h5")
assert(filePath.toFile.exists(), s"calculation output HDF5 '$filePath' does not exist")
val mainFileUri = entry.treeTask.treeBasePath.resolve(entry.relativePath).toUri.toString
validateHDF5(targetFolder, calcName, metaData, validateHDFContent(mainFileUri))
validateHDF5(targetFolder, archiveId, metaData, validateHDFContent(mainFileUri),
Some(s"$calcName.h5"))
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment