display cmd and config name

This commit is contained in:
51616 2025-01-07 10:45:40 +00:00
parent 7d273f4428
commit 1afdb35150
2 changed files with 54 additions and 6 deletions

View file

@ -226,5 +226,28 @@ def get_command(run):
return jsonify({"command": "debug.log not found."})
@app.route("/get_config/<run>")
def get_config(run):
"""
Extracts the config file name from cli_args.yaml.
Args:
run: The name of the training run.
Returns:
A JSON response containing the config file name or an error message.
"""
logdir = os.path.join(TRAIN_OUTPUTS_DIR, run)
cli_args_path = os.path.join(logdir, "cli_args.yaml")
try:
with open(cli_args_path) as f:
cli_args = yaml.safe_load(f)
config_file = cli_args.get("config", "Config file not found.")
return jsonify({"config": config_file})
except FileNotFoundError:
return jsonify({"config": "cli_args.yaml not found."})
if __name__ == "__main__":
app.run(debug=True)

View file

@ -3,10 +3,35 @@
{% block title %}Training Run Visualizer{% endblock %}
{% block content %}
<h1>Select a Training Run</h1>
<ul>
{% for run in runs %}
<li><a href="{{ url_for('visualize', run=run) }}">{{ run }}</a></li>
{% endfor %}
</ul>
<h1>Training Runs</h1>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Run Name</th>
<th>Command</th>
<th>Config File</th>
</tr>
</thead>
<tbody>
{% for run in runs %}
<tr>
<td><a href="{{ url_for('visualize', run=run) }}">{{ run }}</a></td>
<td id="command-{{ run }}">Loading...</td>
<td id="config-{{ run }}">Loading...</td>
</tr>
<script>
fetch("{{ url_for('get_command', run=run) }}")
.then(response => response.json())
.then(data => {
document.getElementById("command-{{ run }}").textContent = data.command;
});
fetch("{{ url_for('get_config', run=run) }}")
.then(response => response.json())
.then(data => {
document.getElementById("config-{{ run }}").textContent = data.config;
});
</script>
{% endfor %}
</tbody>
</table>
{% endblock %}