Initial commit: MLflow dashboard project

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 17:21:51 +09:00
commit 15c2dc95f6
16 changed files with 536 additions and 0 deletions

118
static/app.js Normal file
View File

@@ -0,0 +1,118 @@
const API_BASE = window.location.origin;
function getTrackingUri() {
return document.getElementById('trackingUri').value.trim() || null;
}
function formatTime(ts) {
if (!ts) return '';
const d = new Date(ts);
return d.toLocaleDateString('ko-KR') + ' ' + d.toLocaleTimeString('ko-KR', {hour: '2-digit', minute: '2-digit'});
}
async function loadExperiments() {
const container = document.getElementById('content');
container.innerHTML = '<div class="loading">Loading...</div>';
const uri = getTrackingUri();
const params = uri ? '?tracking_uri=' + encodeURIComponent(uri) : '';
try {
const res = await fetch(API_BASE + '/api/experiments' + params);
if (!res.ok) throw new Error('Failed: ' + res.status);
const experiments = await res.json();
if (experiments.length === 0) {
container.innerHTML = '<div class="loading">No experiments found.</div>';
return;
}
container.innerHTML = '';
experiments.forEach(function(exp) {
const card = document.createElement('div');
card.className = 'exp-card';
card.innerHTML =
'<div class="exp-header" onclick="toggleExp(this, \'' + exp.experiment_id + '\')">' +
'<span class="exp-arrow">&#9654;</span>' +
'<span class="exp-name">' + exp.name + '</span>' +
'<span class="exp-badge">' + exp.run_count + ' runs</span>' +
'</div>' +
'<div class="run-list" id="runs-' + exp.experiment_id + '">' +
'<div class="loading">Loading runs...</div>' +
'</div>';
container.appendChild(card);
});
} catch (e) {
container.innerHTML = '<div class="error">Connection failed: ' + e.message + '</div>';
}
}
async function toggleExp(header, expId) {
const arrow = header.querySelector('.exp-arrow');
const runList = document.getElementById('runs-' + expId);
if (runList.classList.contains('open')) {
runList.classList.remove('open');
arrow.classList.remove('open');
return;
}
arrow.classList.add('open');
runList.classList.add('open');
runList.innerHTML = '<div class="loading">Loading runs...</div>';
const uri = getTrackingUri();
const params = uri ? '?tracking_uri=' + encodeURIComponent(uri) : '';
try {
const res = await fetch(API_BASE + '/api/experiments/' + expId + '/runs' + params);
const runs = await res.json();
if (runs.length === 0) {
runList.innerHTML = '<div class="run-row" style="color:#888;">No runs</div>';
return;
}
runList.innerHTML = '';
runs.forEach(function(run) {
const row = document.createElement('div');
row.className = 'run-row';
row.innerHTML =
'<span class="run-name">' + (run.run_name || run.run_id.substring(0, 8)) + '</span>' +
'<span class="status ' + run.status + '">' + run.status + '</span>' +
'<span class="run-time">' + formatTime(run.start_time) + '</span>' +
'<div class="btn-group">' +
'<button class="btn btn-view" onclick="viewRun(\'' + run.run_id + '\')">View</button>' +
'<button class="btn btn-train" onclick="trainRun(\'' + run.run_id + '\')">Train</button>' +
'<button class="btn btn-serve" onclick="serveRun(\'' + run.run_id + '\')">Serve</button>' +
'</div>';
runList.appendChild(row);
});
} catch (e) {
runList.innerHTML = '<div class="error">Failed to load runs</div>';
}
}
async function viewRun(runId) {
const uri = getTrackingUri();
const params = uri ? '?tracking_uri=' + encodeURIComponent(uri) : '';
try {
const res = await fetch(API_BASE + '/api/runs/' + runId + '/mlflow-link' + params);
const data = await res.json();
window.open(data.url, '_blank');
} catch (e) {
alert('Failed to get MLflow link');
}
}
function trainRun(runId) {
alert('Train is not implemented yet.');
}
function serveRun(runId) {
alert('Serve: model_uri required. Use Swagger UI (/docs) for now.');
}
document.addEventListener('DOMContentLoaded', function() {
loadExperiments();
});

24
static/index.html Normal file
View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MLflow Dashboard</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<div class="header">
<h1>MLflow Dashboard</h1>
<input type="text" id="trackingUri" placeholder="Tracking URI (e.g. http://192.168.200.231:50111)">
<button onclick="loadExperiments()">Connect</button>
</div>
<div class="container" id="content">
<div class="loading">Tracking URI를 입력하고 Connect를 클릭하세요.</div>
</div>
<script src="/static/app.js"></script>
</body>
</html>

85
static/style.css Normal file
View File

@@ -0,0 +1,85 @@
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', sans-serif; background: #f5f5f5; color: #333; }
.header {
background: #1a1a2e; color: white; padding: 16px 24px;
display: flex; align-items: center; gap: 16px;
}
.header h1 { font-size: 20px; font-weight: 600; }
.header input {
padding: 8px 12px; border: none; border-radius: 6px;
width: 360px; font-size: 14px; background: #16213e; color: white;
}
.header input::placeholder { color: #888; }
.header button {
padding: 8px 20px; border: none; border-radius: 6px;
background: #0f3460; color: white; cursor: pointer; font-size: 14px;
}
.header button:hover { background: #1a5276; }
.container { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
.exp-card {
background: white; border-radius: 8px; margin-bottom: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden;
}
.exp-header {
padding: 14px 20px; cursor: pointer; display: flex;
align-items: center; gap: 12px; user-select: none;
transition: background 0.15s;
}
.exp-header:hover { background: #f8f9fa; }
.exp-arrow {
font-size: 12px; color: #666; transition: transform 0.2s;
width: 16px; text-align: center;
}
.exp-arrow.open { transform: rotate(90deg); }
.exp-name { font-weight: 600; font-size: 15px; flex: 1; }
.exp-badge {
background: #e8f0fe; color: #1967d2; padding: 2px 10px;
border-radius: 12px; font-size: 12px; font-weight: 500;
}
.run-list { display: none; border-top: 1px solid #eee; }
.run-list.open { display: block; }
.run-row {
padding: 10px 20px 10px 48px; display: flex; align-items: center;
gap: 12px; border-bottom: 1px solid #f0f0f0; font-size: 14px;
}
.run-row:last-child { border-bottom: none; }
.run-row:hover { background: #fafbfc; }
.run-name { flex: 1; font-weight: 500; }
.status {
padding: 3px 10px; border-radius: 12px; font-size: 11px;
font-weight: 600; text-transform: uppercase; min-width: 80px;
text-align: center;
}
.status.FINISHED { background: #e6f4ea; color: #1e8e3e; }
.status.RUNNING { background: #e8f0fe; color: #1967d2; }
.status.FAILED { background: #fce8e6; color: #d93025; }
.status.KILLED { background: #fef7e0; color: #ea8600; }
.status.SCHEDULED { background: #f3e8fd; color: #8430ce; }
.btn-group { display: flex; gap: 6px; }
.btn {
padding: 5px 14px; border: 1px solid #ddd; border-radius: 4px;
font-size: 12px; cursor: pointer; background: white;
transition: all 0.15s;
}
.btn:hover { background: #f0f0f0; }
.btn-view { border-color: #1967d2; color: #1967d2; }
.btn-view:hover { background: #e8f0fe; }
.btn-train { border-color: #1e8e3e; color: #1e8e3e; }
.btn-train:hover { background: #e6f4ea; }
.btn-serve { border-color: #ea8600; color: #ea8600; }
.btn-serve:hover { background: #fef7e0; }
.loading { text-align: center; padding: 40px; color: #888; }
.error { text-align: center; padding: 40px; color: #d93025; }
.run-time {
color: #888; font-size: 12px; min-width: 140px; text-align: right;
}