Skip to content

Commit

Permalink
add logs partial to param table
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierCladellas committed Jan 21, 2025
1 parent caf4815 commit ad2e4ab
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/feelpp/benchmarking/report/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def main_cli():


report_renderer = RendererFactory.create("benchmark")
logs_renderer = RendererFactory.create("logs")

atomic_reports.movePartials(os.path.join(parser.args.modules_path,"descriptions"))
atomic_reports.createLogReports(os.path.join(parser.args.modules_path,"logs"),logs_renderer)
atomic_reports.createReports(os.path.join(parser.args.modules_path,"reports"),report_renderer)

if parser.args.website:
Expand Down
23 changes: 23 additions & 0 deletions src/feelpp/benchmarking/report/atomicReports/atomicReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@ def movePartials(self,base_dir):
os.rename(os.path.join(self.partials_dir,description_filename), os.path.join(move_dir,description_file_basename))
self.hash_param_map[description_file_basename_splitted]["partial_filepath"] = os.path.join(os.path.relpath(move_dir,start="./docs/modules/ROOT/pages"),description_file_basename)

def createLogReports(self,base_dir, renderer):
for run in self.runs:
for testcase in run["testcases"]:
check_vars = testcase["check_vars"]
if all(var not in check_vars for var in ["script","output_log","error_log"]):
continue

logs_filepath = os.path.join(base_dir,self.machine_id,self.application_id,self.use_case_id,self.filename(),f"{testcase['hash']}.adoc").replace("-","_").replace(":","_").replace("+","Z")
if not os.path.exists(os.path.dirname(logs_filepath)):
os.makedirs(os.path.dirname(logs_filepath))

self.hash_param_map[testcase["hash"]]["logs_filepath"] = os.path.relpath(logs_filepath,start="./docs/modules/ROOT/pages")
renderer.render(
logs_filepath,
dict(
script = check_vars.get("script"),
output_log = check_vars.get("output_log"),
error_log = check_vars.get("error_log")
)
)


def filename(self):
""" Build the filename for the report
Expand All @@ -137,6 +158,8 @@ def parseHashMap(self):
parsed_hashmap[hash] = self.flatten(v["check_params"])
if "partial_filepath" in v:
parsed_hashmap[hash]["partial_filepath"] = v["partial_filepath"]
if "logs_filepath" in v:
parsed_hashmap[hash]["logs_filepath"] = v["logs_filepath"]

headers = []
for entry in parsed_hashmap.values():
Expand Down
12 changes: 12 additions & 0 deletions src/feelpp/benchmarking/report/atomicReports/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ def movePartials(self,base_dir):
for atomic_report in self.data:
atomic_report.movePartials(base_dir)

def createLogReports(self,base_dir, renderer):
""" Create all log reports under a single directory
Args:
base_dir (str): The base directory where the report will be created
renderer (Renderer): The renderer to use
"""
if not os.path.exists(base_dir):
os.mkdir(base_dir)

for atomic_report in self.data:
atomic_report.createLogReports(base_dir,renderer)


def patchPlotConfigs(self,plot_configs, patch_reports_ids, save = False):
""" Replaces the plot configuration with a new one.
Expand Down
3 changes: 2 additions & 1 deletion src/feelpp/benchmarking/report/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def create(renderer_type):
templates = {
"index" : "index.adoc.j2",
"benchmark" : "benchmark.adoc.j2",
"atomic_overview" : "atomicOverview.adoc.j2"
"atomic_overview" : "atomicOverview.adoc.j2",
"logs" : "logs.adoc.j2"
}
try:
return Renderer(base, templates[renderer_type])
Expand Down
4 changes: 2 additions & 2 deletions src/feelpp/benchmarking/report/templates/benchmark.adoc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ include::ROOT:{{description_path}}[leveloffset=+1]
{% if not empty %}

|===
{% for header in hash_params_headers %} | {% if header == 'partial_filepath' %} {% else %} {{ header }} {% endif %} {% endfor %}
{% for header in hash_params_headers %} | {% if header == 'partial_filepath' or header == 'logs_filepath' %} {% else %} {{ header }} {% endif %} {% endfor %}

{% for entry in flat_hash_param_map.values() %}
{% for header in hash_params_headers %}
{% if header == 'partial_filepath' %} | xref:{{ entry.get(header, '') }}[Description] {% else %} | {{ entry.get(header, '') }} {% endif %}
{% if header == 'partial_filepath' %} | xref:{{ entry.get(header, '') }}[Description] {% elif header == 'logs_filepath' %} | xref:{{ entry.get(header, '') }}[Logs] {% else %} | {{ entry.get(header, '') }} {% endif %}
{% endfor %}

{% endfor %}
Expand Down
29 changes: 29 additions & 0 deletions src/feelpp/benchmarking/report/templates/logs.adoc.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
= ReFrame logs

{% if script != "" %}
== ReFrame scheduler script

[source,bash]
----
{{ script }}
----
{% endif %}

{% if error_log != "" %}
== ReFrame log

[source,bash]
----
{{ error_log }}
----
{% endif %}

{% if output_log != "" %}
== ReFrame output log

[source,bash]
----
{{ output_log }}
----

{% endif %}

0 comments on commit ad2e4ab

Please sign in to comment.