Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
661 changes: 486 additions & 175 deletions cace/cace_web.py

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions cace/parameter/parameter_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(
self.datasheet = datasheet
self.max_runs = max_runs
self.run_path = run_path
self.dspath = None

self.worker_thread = None

Expand Down Expand Up @@ -178,6 +179,7 @@ def load_datasheet(self, datasheet_path, init_run_dir=True):
if init_run_dir:
self.prepare_run_dir()

self.dspath = os.path.abspath(datasheet_path)
return 0

def find_datasheet(self, search_dir, init_run_dir=True):
Expand Down Expand Up @@ -250,14 +252,20 @@ def get_datasheet(self):
"""Return the datasheet"""
return self.datasheet

def summarize_datasheet(self):
return markdown_summary(
def summarize_datasheet(self, save=False):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the "save" argument again?

md_sum = markdown_summary(
self.datasheet,
self.runtime_options,
self.results,
self.result_types,
)

if save:
with open(self.run_dir + '/summary.md', 'w') as f:
print(md_sum, file=f)

return md_sum

def generate_documentation(self):
if 'documentation' in self.datasheet['paths']:
doc_path = os.path.join(
Expand Down
59 changes: 49 additions & 10 deletions cace/web/html_templates.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import jinja2

# Template for the table with progress bars
PROGRESS_TEMPLATE = jinja2.Template(
"""
<table id="progress_table">
Expand All @@ -15,29 +16,34 @@
<tr>
<td>{{ param }}</td>
<td>
<progress id="{{param}}" value="0" max="100"></progress>
<div class="progress" id="{{ param }}" role="progressbar" aria-valuenow="0" aria-valuemax="0" style="width: 300px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 0%"></div>
</div>
</td>
<td>
<button type="button" class="btn btn-danger" id="{{ param }}cancelbtn" onclick="sendData({ 'task': 'cancel_sim', 'param': '{{ param }}' });">Cancel</button>
<button type="button" class="btn btn-outline-danger" id="{{ param }}cancelbtn" onclick="cancel_sim('{{ param }}');">Cancel</button>
</td>
</tr>
{% endfor %}
<tr>
<td>Overall Progress</td>
<td>
<progress id="overall_pb" value="0" max="{{params | length}}"></progress>
<div class="progress" id="overall_pb" role="progressbar" aria-valuenow="0" aria-valuemax="{{ params | length }}" style="width: 300px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 0%"></div>
</div>
</td>
</tr>
</tbody>
</table>
<br>
<button type="button" class="btn btn-success" id="simresultsbtn" onclick="openTab(event, 'Results')" disabled>Simulation Results</button>
<button type="button" class="btn btn-danger" id="cancelbtn" onclick="sendData({ 'task': 'cancel_sims' });">Cancel Simulations</button>
<button type="button" class="btn btn-danger" id="cancelbtn" onclick="cancel_sims();">Cancel Simulations</button>
<br>
<br>
"""
)

# Template for the table showing run results
RESULTS_SUMMARY_TEMPLATE = jinja2.Template(
"""
<table>
Expand All @@ -46,12 +52,12 @@
<th>Parameter</th>
<th>Tool</th>
<th>Result</th>
<th>Minimum Limit</th>
<th>Minimum Value</th>
<th>Typical Limit</th>
<th>Typical Value</th>
<th>Maximum Limit</th>
<th>Maximum Value</th>
<th>Min Limit</th>
<th>Min Value</th>
<th>Typ Limit</th>
<th>Typ Value</th>
<th>Max Limit</th>
<th>Max Value</th>
<th>Status</th>
</tr>
</thead>
Expand All @@ -75,10 +81,43 @@
"""
)

# Template for the mpld3 plots
RESULTS_PLOTS_TEMPLATE = jinja2.Template(
"""
{% for div in divs %}
{{ div | safe }}
{% endfor %}
"""
)

# Template for the history entries
HISTORY_TEMPLATE = jinja2.Template(
"""
<button type="button" class="btn btn-secondary" onclick="refresh_history()"><i class="bi bi-arrow-repeat icon-lg"></i>Refresh</button>
<br />
<br />
<div id="comp-holder" class="comp-parent">
<div id="compare_left" class="comp-holder">
{% for i in range(runs|length) %}
<details id="{{ runs[i] }}_details">
<summary>{{ runs[i] }}</summary>
<div class="comp-btn-holder" id="{{ runs[i] }}_compare_holder">
<button type="button" class="btn btn-primary right-align" onclick="compare('{{ runs[i] }}')"><i class="bi bi-arrow-left-right icon-lg"></i> Compare</button>
</div>
<div class="small-table">{{ results[i] | safe }}</div>
</details>
{% endfor %}
<br />
</div>
</div>
"""
)

# Generic template for a danger warning
DANGER_ALERT_TEMPLATE = jinja2.Template(
"""
<div class="alert alert-danger" role="alert">
<i class="bi bi-exclamation-octagon icon-lg"></i>{{ text }}
</div>
"""
)
Loading
Loading