Skip to content

Commit 369cf6c

Browse files
Merge branch 'master' into 380-support-figure-and-table-references
2 parents 45cef39 + 98abe58 commit 369cf6c

File tree

14 files changed

+317
-217
lines changed

14 files changed

+317
-217
lines changed

examples/overview.json

Lines changed: 222 additions & 167 deletions
Large diffs are not rendered by default.

examples/website_config.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
"template_defaults":{
1111
"repositories":{
1212
"template": "${TEMPLATE_DIR}/overview.adoc.j2",
13-
"data":{"filepath":"./reports/overview.json","prefix":"plots"}
13+
"data":{"filepath":"./examples/overview.json","prefix":"plots"}
1414
},
1515
"components":{
1616
"all": {
17-
"template": "${TEMPLATE_DIR}/overview.adoc.j2"
17+
"template": "${TEMPLATE_DIR}/overview.adoc.j2",
18+
"data":{"filepath":"./examples/overview.json","prefix":"plots"}
1819
},
1920
"machines": {
2021
"template": "${TEMPLATE_DIR}/machineOverview.adoc.j2",
@@ -50,37 +51,36 @@
5051
"parallelSum": {"title": "parallelSum", "description": "Compute the sum of an array using MPI","card_image":"fa-solid fa-plus" }
5152
},
5253
"use_cases":{
53-
"multiplication": {"title":"multiplication", "description":"Multiplication between different objects", "card_image":"fa-solid fa-times"}
54+
"Fibonacci": { "title": "Fibonacci", "description": "n-th Fibonacci number", "card_image": "fa-solid fa-fan" },
55+
"Multiplication": { "title": "Multiplication", "description": "Multiplication between different objects", "card_image": "fa-solid fa-times" },
56+
"parallel_sum": { "title": "Parallel_Sum", "description": "Compute the sum of an array using MPI", "card_image": "fa-solid fa-plus" },
57+
"sorting": { "title": "Sorting", "description": "Sorting algorithms", "card_image": "fa-solid fa-arrow-up-wide-short" }
5458
}
55-
5659
},
5760
"component_map": {
58-
"component_order": [ "machines", "applications", "use_cases" ],
59-
"mapping": {
60-
"gaya": {
61-
"sortingApp": {
62-
"path": "./reports/sortingApp/sorting/gaya",
63-
"template_info": { "application": "sortingApp", "machine": "gaya" }
64-
},
65-
"fibonacci": {
66-
"path": "./reports/fibonacci/Fibonacci/gaya",
67-
"template_info": { "application": "fibonacci", "machine": "gaya" }
68-
},
69-
"matrixvector": {
70-
"multiplication":{
71-
"path": "./reports/matrixvector/Multiplication/gaya",
72-
"template_info": { "application": "matrixvector", "machine": "gaya", "use_case":"multiplication"}
73-
}
74-
},
75-
"parallelSum": {
76-
"path": "./reports/parallelSum/parallel_sum/gaya",
77-
"template_info": { "application": "parallelSum", "machine": "gaya" }
61+
"default": {
62+
"sortingApp": {
63+
"sorting":{
64+
"path": "./reports/sortingApp/sorting/default",
65+
"template_info": { "application": "sortingApp", "machine": "default" }
7866
}
7967
},
80-
"discoverer":{
81-
"fibonacci": {
82-
"path": "./reports/fibonacci/Fibonacci/discoverer",
83-
"template_info": { "application": "fibonacci", "machine": "discoverer" }
68+
"fibonacci": {
69+
"Fibonacci":{
70+
"path": "./reports/fibonacci/Fibonacci/default",
71+
"template_info": { "application": "fibonacci", "machine": "default" }
72+
}
73+
},
74+
"matrixvector": {
75+
"Multiplication":{
76+
"path": "./reports/matrixvector/Multiplication/default",
77+
"template_info": { "application": "matrixvector", "machine": "default", "use_case":"multiplication"}
78+
}
79+
},
80+
"parallelSum": {
81+
"parallel_sum":{
82+
"path": "./reports/parallelSum/parallel_sum/default",
83+
"template_info": { "application": "parallelSum", "machine": "default" }
8484
}
8585
}
8686
}

src/feelpp/benchmarking/dashboardRenderer/core/treeBuilder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def render( self, base_path:str ) -> None:
134134
super().render(base_path,None,renderLeaves=False)
135135
self.leaf_repository.render(base_path)
136136

137-
def patchTemplateInfo( self, patches:list[str], targets:str, prefix:str, save:bool = False ):
137+
def patchTemplateInfo( self, patches:List[str], targets:str, prefix:str, save:bool = False ):
138138
"""
139139
Applies template patches to specific leaf components based on the given target criteria.
140140

src/feelpp/benchmarking/dashboardRenderer/repository/leafLoader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, location:str, template_info: TemplateInfo) -> None:
5959
if not os.path.exists( location ):
6060
warnings.warn(f"{location} does not contain any files")
6161

62-
def load(self,repository:Repository, parent_ids:list[str]) -> None:
62+
def load(self,repository:Repository, parent_ids:List[str]) -> None:
6363
"""
6464
Load local leaf components (in the filesystem) into the repository.
6565
It iterates over subdirectories in the `self.location`, treating each as a separate leaf component, and uses the `ViewFactory` to create a view for it.

src/feelpp/benchmarking/dashboardRenderer/schemas/dashboardSchema.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,27 @@ class TemplateDataFile(BaseModel):
2727
prefix: Optional[str] = ""
2828
format: str = None
2929
action: Optional[str] = "input"
30+
platform: Optional[str] = "local"
3031
filepath: str
3132

3233
@model_validator(mode="after")
3334
def checkFormat(self):
34-
if self.format is None:
35-
self.format = self.filepath.split(".")[-1]
35+
if self.platform == "local":
36+
if self.format is None:
37+
self.format = self.filepath.split(".")[-1]
38+
else:
39+
if self.format is None:
40+
raise ValueError("Format must be specified for remote data")
3641
return self
3742

43+
@field_validator("platform",mode="after")
44+
@classmethod
45+
def checkPlatform(cls,v):
46+
if v not in ["local","girder"]:
47+
raise NotImplementedError(f"Data management platform not supported : {v}")
48+
return v
49+
50+
3851
class TemplateInfo(BaseModel):
3952
template:Optional[str] = None
4053
data: Union[
@@ -124,11 +137,11 @@ def castNodeTemplateInfo(cls,v):
124137

125138

126139
class DashboardSchema(BaseModel):
127-
dashboard_metadata:Optional[Union[dict[str,str],TemplateInfo]] = TemplateInfo(data={})
140+
dashboard_metadata:Optional[Union[Dict[str,str],TemplateInfo]] = TemplateInfo(data={})
128141
component_map: Union[ComponentMap,Dict]
129-
components: Dict[str,Dict[str, Union[dict[str,str],TemplateInfo]]]
142+
components: Dict[str,Dict[str, Union[Dict[str,str],TemplateInfo]]]
130143
views : Optional[Dict[str,Union[Dict,str]]] = None
131-
repositories : Optional[Dict[str,Union[dict[str,str],TemplateInfo]]] = None
144+
repositories : Optional[Dict[str,Union[Dict[str,str],TemplateInfo]]] = None
132145
template_defaults: Optional[TemplateDefaults] = TemplateDefaults()
133146

134147
@model_validator(mode="after")
@@ -230,5 +243,5 @@ def setTemplateDefaults(self):
230243

231244
if not component_data.template:
232245
component_data.template = template
233-
246+
component_data.data = component_data.data[::-1] #Put defaults at the start so actual values overwrite
234247
return self

src/feelpp/benchmarking/dashboardRenderer/views/templateDataHandler.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
1+
from feelpp.benchmarking.dashboardRenderer.handlers.girder import GirderHandler
22
from feelpp.benchmarking.dashboardRenderer.schemas.dashboardSchema import TemplateInfo,TemplateDataFile
33
from feelpp.benchmarking.json_report.renderer import JsonReportController
4-
import json, os, warnings
4+
import json, os, warnings, tempfile
55
from typing import Union, Dict,Any
66

77
class DataHandler:
@@ -49,7 +49,15 @@ def extractData( self, data: TemplateDataFile, partials:Dict[str,Any] = {}, extr
4949
UserWarning: If a file specified by `filepath` does not exist and the action is "input".
5050
JSONDecodeError: If the file content is not valid JSON.
5151
"""
52-
filepath = os.path.join( self.template_data_dir, data.filepath ) if self.template_data_dir else data.filepath
52+
if data.platform != "local":
53+
tmpdir = tempfile.mkdtemp()
54+
if data.platform == "girder":
55+
download_handler = GirderHandler( tmpdir )
56+
download_handler.downloadFile(data.filepath,name=data.filepath)
57+
local_filepath = os.path.join(tmpdir,data.filepath)
58+
filepath = local_filepath
59+
else :
60+
filepath = os.path.join( self.template_data_dir, data.filepath ) if self.template_data_dir else data.filepath
5361
if data.action == "input":
5462
if not os.path.exists( filepath ):
5563
warnings.warn(f"{filepath} does not exist. Skipping")
@@ -60,6 +68,9 @@ def extractData( self, data: TemplateDataFile, partials:Dict[str,Any] = {}, extr
6068
if not content:
6169
content = "{}"
6270
template_data = json.loads(content)
71+
72+
if data.platform != "local":
73+
os.remove(local_filepath)
6374
if data.prefix:
6475
return {data.prefix: template_data}
6576
return template_data

src/feelpp/benchmarking/json_report/figures/schemas/plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class PlotAxis(BaseModel):
55
parameter: str
66
label:Optional[str] = None
7-
filter:Optional[Union[str,list[str],dict[str,str],list[dict[str,str]]]] = []
7+
filter:Optional[Union[str,List[str],Dict[str,str],List[Dict[str,str]]]] = []
88

99
@field_validator("filter",mode="after")
1010
@classmethod

src/feelpp/benchmarking/json_report/figures/templates/tikz/groupedBarChart.tex.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
ybar,
2424
legend style={at={(0.5,-0.1)},anchor=north}
2525
]
26-
{% for var,name in zip(variables,names) %}
26+
{% for var in variables %}
2727
\addplot table [x expr=\coordindex, y={{ var }}] {{'{#2}'}} ;
28-
\addlegendentry{ {{name}} }
28+
\addlegendentry{ {{var}} }
2929
{% endfor %}
3030

3131
\end{axis}

src/feelpp/benchmarking/json_report/figures/templates/tikz/scatterChart.tex.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
xticklabels from table={{'{#2}'}}{{'{'}}{{xaxis.parameter}}{{'}'}},
2222
cycle list name=color list, legend style={at={(0.5,-0.1)},anchor=north}
2323
]
24-
{% for var,name in zip(variables,names) %}
24+
{% for var in variables %}
2525
{% if var not in fill_lines %}
2626
\addplot table [x expr=\coordindex, y={{ var }}] {{'{#2}'}} ;
27-
\addlegendentry{ {{name}} }
27+
\addlegendentry{ {{var}} }
2828
{% endif %}
2929
{% endfor %}
3030

src/feelpp/benchmarking/json_report/figures/templates/tikz/stackedBarChart.tex.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
{% if i > 1 %}
4242
\resetstackedplots
4343
{% endif %}
44-
{% for var,name,color in zip(variables,names, colors) %}
44+
{% for var,color in zip(variables, colors) %}
4545
\addplot+[ybar, bar width=0.2,point meta=y,draw=black,fill={{color}}{% if i > 1 %}, forget plot{% endif %} ] table [x expr=\coordindex+0.25*{{i}}, y={{ var }}] {\data{{i | inttouniquestr}}} ;
4646
{% if i == 1%}
47-
\addlegendentry{ {{name}} }
47+
\addlegendentry{ {{var}} }
4848
{% endif %}
4949
{% endfor %}
5050
{% endfor %}

0 commit comments

Comments
 (0)