Files
OpenBench/Templates/OpenBench/tune.html
T
Andrew Grant ee267381fc Implement SPSA for OpenBench (#169)
* Support Worker and Thread Limits
* Drop report_rate from the Client
* Creation page
* WIP for SPSA; Lots of code shuffling to clean it up
* Able to create a Tune in the interface
* Start to work on a display page for Tunes
* Move all workload utilities to their own dir
* Ignore config files going forward
* Able to produce an SPSA test from the Server
* Round integers with probabilities that make sense
* Client side working
* Report as results come in, don't wait
* Fix workload size comment
* Cleanup and fix Tune modifications
* Adustment to random value in tuning
* Delete engine configs
2023-09-19 14:44:52 -04:00

219 lines
9.2 KiB
HTML

{% extends "OpenBench/base.html" %}
{% load mytags %}
{% block style %}
{% endblock %}
{% block scripts %}
<script>
function copy_statblock() {
var text = document.getElementById("long-statblock").innerHTML;
text = text.replace(/<br>/g, "\n");
text += "\n" + window.location.href;
// navigator.clipboard.writeText(text); // Optimal solution
// Suboptimal, HTTP solution
var area = document.createElement("textarea");
area.value = text;
document.body.append(area);
area.focus();
area.select();
try {
document.execCommand("copy");
document.body.removeChild(area);
}
catch (err) {
document.body.removeChild(area);
console.error("Unable to copy to Clipboard");
}
}
</script>
{% endblock %}
{% block content %}
<div id="config" style="display: block; overflow-x: auto;">
<table class="test-config left-align wrappable" style="table-layout: auto; width: 100%;">
<tr><td class="td-label">Author</td><td>{{test.author|capfirst}}</td></tr>
<tr><td class="td-label">Creation</td><td class="timestamp">{{test.creation|date:'U'}}</td></tr>
<tr><td class="td-label">Engine</td><td>{{test.dev_engine}}</td></tr>
<tr><td class="td-label">Source</td><td><a href="{{test.dev_repo}}">{{test.dev_repo}}</a></td></tr>
<tr><td class="td-label">Sha</td><td>{{test.dev.sha}}</td></tr>
<tr><td class="td-label">Branch</td><td>{{test.dev.name|prettyName}}</td></tr>
<tr><td class="td-label">Bench</td><td>{{test.dev.bench}}</td></tr>
{% if test.dev_network %}
<tr>
<td class="td-label">Network</td>
<td><a href="{{test.devnetwork|resolveNetworkURL}}">{{test.dev_netname}}</td>
</tr>
{% endif %}
<tr><td class="td-label">Options</td><td>{{test.dev_options}}</td></tr>
<tr><td class="td-label">Time</td><td>{{test.dev_time_control}}</td></tr>
<tr><td class="td-label">Opening Book</td><td><a href="{{config.framework}}raw/master/Books/{{test.bookname}}.zip">{{test.book_name}}</a></td></tr>
<tr><td class="td-label">Syzygy WDL</td><td>{{test.syzygy_wdl}}</td></tr>
<tr><td class="td-label">Syzygy ADJ.</td><td>{{test.syzygy_adj}}</td></tr>
<tr><td class="td-label">Win ADJ.</td><td>{{test.win_adj}}</td></tr>
<tr><td class="td-label">Draw ADJ.</td><td>{{test.draw_adj}}</td></tr>
<tr><td class="td-label">Alpha</td><td>{{test.spsa.Alpha}}</td></tr>
<tr><td class="td-label">Gamma</td><td>{{test.spsa.Gamma}}</td></tr>
<tr><td class="td-label">A-Ratio</td><td>{{test.spsa.A}}</td></tr>
</table>
</div>
<div id="actions" class="ml-3">
<!-- Dev vs Base [Git Diff Link] -->
<h4><a href="{{test|gitDiffLink}}">
{{test.dev.name|prettyName}} vs {{test.base.name|prettyName}}
</a></h4>
<!-- Approve Button: For Admins, or Cross-approvers -->
{% if not test.approved and profile.approver and profile.user.username != test.author %}
<a class="w-25 mr-2 anchorbutton btn-blue" href="/tune/{{test.id}}/APPROVE">Approve</a>
{% elif not test.approved and request.user.is_superuser %}
<a class="w-25 mr-2 anchorbutton btn-blue" href="/tune/{{test.id}}/APPROVE">Approve</a>
{% else %}
<a class="w-25 mr-2 anchorbutton btn-disabled">Approve</a>
{% endif %}
<!-- Restart Button: For Approvers or Test Authors of finished tests -->
{% if test.finished and profile.approver %}
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/RESTART">Restart</a>
{% elif test.finished and profile.user.username == test.author %}
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/RESTART">Restart</a>
{% elif test.finished %}
<a class="w-25 mr-2 anchorbutton btn-disabled">Restart</a>
{% endif %}
<!-- Stop Button: For Approvers or Test Authors of active tests -->
{% if not test.finished and profile.approver %}
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/STOP">Stop</a>
{% elif not test.finished and profile.user.username == test.author %}
<a class="w-25 mr-2 anchorbutton btn-yellow" href="/tune/{{test.id}}/STOP">Stop</a>
{% elif not test.finished %}
<a class="w-25 mr-2 anchorbutton btn-disabled">Stop</a>
{% endif %}
<!-- Delete/Restore Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %}
{% if test.deleted %}
<a class="w-25 mr-2 anchorbutton btn-preset" href="/tune/{{test.id}}/RESTORE">Restore</a>
{% else %}
<a class="w-25 mr-2 anchorbutton btn-red" href="/tune/{{test.id}}/DELETE">Delete</a>
{% endif %}
{% else %}
{% if test.deleted %}
<a class="w-25 mr-2 anchorbutton btn-disabled">Restore</a>
{% else %}
<a class="w-25 mr-2 anchorbutton btn-disabled">Delete</a>
{% endif %}
{% endif %}
<!-- Copy Button: Copy the current results statblock -->
<a class="copy-button" onclick="copy_statblock()">
<i class="fa-regular fa-clone copy-button"></i>
</a>
<!-- Elo, (SPRT/LRR if SPRT, otherwise CONF), Games -->
<!-- For SPSA, # of Params, Iterations, and Games -->
<pre class="long-statblock" id="long-statblock">{{test|shortStatBlock|linebreaksbr}}</pre>
<!-- Forum to modify the Priority or Throughput -->
<form method="POST" action="/tune/{{test.id}}/MODIFY">
{% csrf_token %}
<div class="form">
<div class="col-full">
<div class="row">
<label>Priority</label>
<input value="{{test.priority}}" name="priority">
</div>
<div class="row">
<label>Throughput</label>
<input value="{{test.throughput}}" name="throughput">
</div>
<div class="row">
<label>Worker Limit</label>
<input value="{{test.worker_limit|default:'None'}}" name="worker_limit">
</div>
<div class="row">
<label>Thread Limit</label>
<input value="{{test.thread_limit|default:'None'}}" name="thread_limit">
</div>
<!-- Edit Button: For Approvers or Test Authors -->
{% if profile.approver or profile.user.username == test.author %}
<input class="anchorbutton btn-blue w-100" type="submit" name="submit" value="Modify">
{% else %}
<input class="anchorbutton btn-disabled w-100" type="submit" name="submit" value="Modify">
{% endif %}
</div>
</div>
</form>
</div>
<div id="parameters" class="w-100 mt-3" style="float:left;">
<table class="stripes wrappable">
<tr class="table-header">
<th> Name </th>
<th> Start </th>
<th> Curr </th>
<th> Min </th>
<th> Max </th>
<th> C </th>
<th> C_end </th>
<th> R </th>
<th> R_end </th>
</tr>
{% for row in test|spsa_param_digest %}
<tr>
{% for element in row %}
<td> {{ element }} </td>
{% endfor %}
<tr>
{% endfor %}
</table>
</div>
<div id="results" class="w-100 mt-3" style="float:left;">
<table class="stripes wrappable">
<tr class="table-header">
<th>#</th>
<th>User</th>
<th>Updated</th>
<th style="width: 45px">Games</th>
<th style="width: 45px">Won</th>
<th style="width: 45px">Lost</th>
<th style="width: 45px">Drawn</th>
<th style="width: 45px">Time</th>
<th style="width: 45px">Crash</th>
</tr>
{% for result in results %}
<tr>
<td><a href="/machines/{{result.machine.id}}">{{result.machine.id}}</a></td>
<td>{{result.machine.user.username|capfirst}}</td>
<td class="timestamp">{{result.updated|date:'U'}}</td>
<td class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td>
<td class="numeric">{{result.losses}}</td>
<td class="numeric">{{result.draws}}</td>
<td class="numeric">{{result.timeloss}}</td>
<td class="numeric">{{result.crashes}}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}