Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-lab-base
Commits
70582cb8
Commit
70582cb8
authored
Jul 11, 2018
by
Ihrig, Arvid Conrad (ari)
Browse files
Integrated Pipeline: adjusted paths inside single-calculations HDF5 to match standard
parent
9cca0a6a
Changes
3
Hide whitespace changes
Inline
Side-by-side
integrated-pipeline/src/main/scala/eu/nomad_lab/integrated_pipeline/io_integrations/WriteToHDF5ResultsProcessor.scala
View file @
70582cb8
...
...
@@ -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
{
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_end_to_end_tests/package.scala
View file @
70582cb8
...
...
@@ -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
}
...
...
integrated-pipeline/src/test/scala/eu/nomad_lab/integrated_pipeline_tests/WriteToHDF5ResultsProcessorSpec.scala
View file @
70582cb8
...
...
@@ -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"
))
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment