Skip to content

Commit 4a9452e

Browse files
committed
format metadata
1 parent 3b65332 commit 4a9452e

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

pypeec/lib_check/check_data_options.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,8 @@ def check_data_voxel(data_voxel):
6969
schema = {
7070
"type": "object",
7171
"required": [
72-
"pkg_name",
73-
"pkg_version",
7472
"format",
75-
"date",
76-
"duration",
77-
"seconds",
73+
"meta",
7874
"status",
7975
"data_geom",
8076
],
@@ -99,12 +95,8 @@ def check_data_solution(data_solution):
9995
schema = {
10096
"type": "object",
10197
"required": [
102-
"pkg_name",
103-
"pkg_version",
10498
"format",
105-
"date",
106-
"duration",
107-
"seconds",
99+
"meta",
108100
"status",
109101
"data_init",
110102
"data_sweep",

pypeec/run/mesher.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,25 @@ def _get_data(data_geom, timestamp):
218218
Assemble the returned data.
219219
"""
220220

221-
# end message
221+
# get timing information
222222
(seconds, duration, date) = scilogger.get_duration(timestamp)
223223

224-
# get status
225-
status = True
226-
227-
# extract the solution
228-
data_voxel = {
224+
# construct the metadata
225+
meta = {
229226
"pkg_name": pypeec.__name__,
230227
"pkg_version": pypeec.__version__,
231-
"format": "mesher",
232228
"date": date,
233229
"duration": duration,
234230
"seconds": seconds,
231+
}
232+
233+
# get status (mesher always terminates successfully)
234+
status = True
235+
236+
# assemble the output data
237+
data_voxel = {
238+
"format": "pypeec_mesher",
239+
"meta": meta,
235240
"status": status,
236241
"data_geom": data_geom,
237242
}

pypeec/run/solver.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -592,28 +592,33 @@ def _get_data(data_init, data_sweep, timestamp):
592592
Assemble the returned data.
593593
"""
594594

595-
# end message
595+
# get timing information
596596
(seconds, duration, date) = scilogger.get_duration(timestamp)
597597

598-
# get status
598+
# construct the metadata
599+
meta = {
600+
"pkg_name": pypeec.__name__,
601+
"pkg_version": pypeec.__version__,
602+
"date": date,
603+
"duration": duration,
604+
"seconds": seconds,
605+
}
606+
607+
# get status (combine the status of the all the sweeps)
599608
status = True
600609
for data_sweep_tmp in data_sweep.values():
601610
status = status and data_sweep_tmp["solution_ok"]
602611
status = status and data_sweep_tmp["solver_ok"]
603612
status = status and data_sweep_tmp["condition_ok"]
604613

605-
# get warning
614+
# show warning if the status is negative
606615
if not status:
607616
LOGGER.warning("problem detected for the solver")
608617

609-
# extract the solution
618+
# assemble the output data
610619
data_solution = {
611-
"pkg_name": pypeec.__name__,
612-
"pkg_version": pypeec.__version__,
613-
"format": "solver",
614-
"date": date,
615-
"duration": duration,
616-
"seconds": seconds,
620+
"format": "pypeec_solver",
621+
"meta": meta,
617622
"status": status,
618623
"data_init": data_init,
619624
"data_sweep": data_sweep,

0 commit comments

Comments
 (0)