Upload 6 files
Browse files- web/static/app.js +1 -1
- web/static/runs.js +29 -5
web/static/app.js
CHANGED
|
@@ -530,7 +530,7 @@ async function refreshRunReportPreview(runId){
|
|
| 530 |
console.warn('report refresh failed',e);
|
| 531 |
}
|
| 532 |
}
|
| 533 |
-
async function refreshProgress(){if(!state.runId||state.progressPollInFlight)return;state.progressPollInFlight=true;try{const now=Date.now();const includeLogs=!state.lastJobLogPoll||now-state.lastJobLogPoll>8000;if(includeLogs)state.lastJobLogPoll=now;const p=await apiGet(`/api/runs/${encodeURIComponent(state.runId)}/progress?bucket_name=${encodeURIComponent(state.bucketName)}${includeLogs?'&include_job_logs=1':''}`);state.activeRunProgress=p;state.pollErrors=0;if(p.bucket_source)state.bucketSource=p.bucket_source;renderProgress(p);renderEvents(p.events||[]);renderMetrics(p);if(typeof renderActiveRunActions==='function')renderActiveRunActions(p.summary||{},p);if(typeof renderRunDocuments==='function')renderRunDocuments(p);if(typeof renderAgentRecovery==='function')renderAgentRecovery(p);if(p.view){setText('detailRunId',p.view.run_id||p.run_id);setText('selectedModelId',p.view.header?.model||p.summary?.model_id||'—')}else{setText('detailRunId',p.run_id||state.runId)}if(p.state){setText('detailSpace',p.state.target_space||p.summary?.target_space||'—');const mode=runImplementationMode(p.summary||{},p);setText('detailImplementationMode',mode?implementationModeLabel(mode):'—');const modeEl=$('detailImplementationMode');if(modeEl&&mode)modeEl.title=implementationModeDescription(mode);setText('detailHardware',p.state.selected_hardware||p.summary?.selected_hardware||'—')}setText('detailJobStatus',p.status||p.state?.status||p.view?.header?.raw_status||'running');setText('detailGateStatus',p.inference_gate?.status||p.summary?.gate_status||'—');setText('detailTraces',Array.isArray(p.events)?String(p.events.length)+' events':'—');setText('homeRunDetailStatus',badgeLabel(p.status||p.state?.status||p.view?.header?.status||'running'));setQuickLinks({...p.links,...p.view?.links,bucket_source:p.bucket_source,run_id:p.run_id},{...p,events:p.events||[]});saveActiveRun();const status=String(p.view?.header?.status||p.status||p.state?.status||'').toLowerCase();if(TERMINAL_STATUSES.has(status)&&state.poll){clearInterval(state.poll);state.poll=null;if(state.lastReportRefreshRunId!==state.runId){state.lastReportRefreshRunId=state.runId;refreshRunReportPreview(state.runId)}setOperation(`Run finished with status: ${badgeLabel(status)}`,status.includes('success')||status.includes('succeed')?'success':status.includes('failed')||status.includes('blocker')?'error':'warning')}if(now-(state.lastRunsRefreshFromPoll||0)>15000){state.lastRunsRefreshFromPoll=now;loadRuns(false)}}catch(e){state.pollErrors+=1;console.warn(e);setOperation(`Progress polling failed ${state.pollErrors} time${state.pollErrors===1?'':'s'}. Retrying automatically…`,'warning')}finally{state.progressPollInFlight=false}} function numberFromEvents(events=[],keys=[]){
|
| 534 |
const rows=Array.isArray(events)?events:[];
|
| 535 |
for(let i=rows.length-1;i>=0;i--){
|
| 536 |
const event=rows[i]||{};
|
|
|
|
| 530 |
console.warn('report refresh failed',e);
|
| 531 |
}
|
| 532 |
}
|
| 533 |
+
async function refreshProgress(){if(!state.runId||state.progressPollInFlight)return;state.progressPollInFlight=true;try{const now=Date.now();const includeLogs=!state.lastJobLogPoll||now-state.lastJobLogPoll>8000;if(includeLogs)state.lastJobLogPoll=now;const p=await apiGet(`/api/runs/${encodeURIComponent(state.runId)}/progress?bucket_name=${encodeURIComponent(state.bucketName)}${includeLogs?'&include_job_logs=1':''}`);state.activeRunProgress=p;state.pollErrors=0;if(p.bucket_source)state.bucketSource=p.bucket_source;renderProgress(p);renderEvents(p.events||[]);renderMetrics(p);if(typeof upsertRunExplorerFromProgress==='function')upsertRunExplorerFromProgress(p);if(typeof renderActiveRunActions==='function')renderActiveRunActions(p.summary||{},p);if(typeof renderRunDocuments==='function')renderRunDocuments(p);if(typeof renderAgentRecovery==='function')renderAgentRecovery(p);if(p.view){setText('detailRunId',p.view.run_id||p.run_id);setText('selectedModelId',p.view.header?.model||p.summary?.model_id||'—')}else{setText('detailRunId',p.run_id||state.runId)}if(p.state){setText('detailSpace',p.state.target_space||p.summary?.target_space||'—');const mode=runImplementationMode(p.summary||{},p);setText('detailImplementationMode',mode?implementationModeLabel(mode):'—');const modeEl=$('detailImplementationMode');if(modeEl&&mode)modeEl.title=implementationModeDescription(mode);setText('detailHardware',p.state.selected_hardware||p.summary?.selected_hardware||'—')}setText('detailJobStatus',p.status||p.state?.status||p.view?.header?.raw_status||'running');setText('detailGateStatus',p.inference_gate?.status||p.summary?.gate_status||'—');setText('detailTraces',Array.isArray(p.events)?String(p.events.length)+' events':'—');setText('homeRunDetailStatus',badgeLabel(p.status||p.state?.status||p.view?.header?.status||'running'));setQuickLinks({...p.links,...p.view?.links,bucket_source:p.bucket_source,run_id:p.run_id},{...p,events:p.events||[]});saveActiveRun();const status=String(p.view?.header?.status||p.status||p.state?.status||'').toLowerCase();if(TERMINAL_STATUSES.has(status)&&state.poll){clearInterval(state.poll);state.poll=null;if(state.lastReportRefreshRunId!==state.runId){state.lastReportRefreshRunId=state.runId;refreshRunReportPreview(state.runId)}setOperation(`Run finished with status: ${badgeLabel(status)}`,status.includes('success')||status.includes('succeed')?'success':status.includes('failed')||status.includes('blocker')?'error':'warning')}if(now-(state.lastRunsRefreshFromPoll||0)>15000){state.lastRunsRefreshFromPoll=now;loadRuns(false)}}catch(e){state.pollErrors+=1;console.warn(e);setOperation(`Progress polling failed ${state.pollErrors} time${state.pollErrors===1?'':'s'}. Retrying automatically…`,'warning')}finally{state.progressPollInFlight=false}} function numberFromEvents(events=[],keys=[]){
|
| 534 |
const rows=Array.isArray(events)?events:[];
|
| 535 |
for(let i=rows.length-1;i>=0;i--){
|
| 536 |
const event=rows[i]||{};
|
web/static/runs.js
CHANGED
|
@@ -275,6 +275,33 @@ function optimisticDetailFromSummary(summary={}){
|
|
| 275 |
},
|
| 276 |
};
|
| 277 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
function renderRunSelectionPreview(runId){
|
| 279 |
const cached=cachedRunById(runId);
|
| 280 |
if(!cached)return;
|
|
@@ -429,9 +456,6 @@ function deriveRunDocuments(detail={}){
|
|
| 429 |
const files=Array.isArray(detail.files)?detail.files:[];
|
| 430 |
const filePaths=new Set(files.map(f=>String(f.path||'')));
|
| 431 |
const hasPrefix=prefix=>files.some(f=>String(f.path||'').startsWith(prefix.replace(/\/$/,'')+'/'));
|
| 432 |
-
const events=Array.isArray(detail.events)?detail.events:[];
|
| 433 |
-
const eventPassed=(step,statuses=['success','warning','failed'])=>events.some(e=>String(e.step||'')===step&&statuses.includes(String(e.status||'').toLowerCase()));
|
| 434 |
-
const tracesCollected=eventPassed('traces',['success']);
|
| 435 |
const reportText=String(detail.report||'');
|
| 436 |
const summary=detail.summary||{};
|
| 437 |
const blockers=detail.technical_blockers||{};
|
|
@@ -442,9 +466,9 @@ function deriveRunDocuments(detail={}){
|
|
| 442 |
if(!byId.has('pi_redacted_trace'))byId.set('pi_redacted_trace',defaultRunDocuments(detail)[1]);
|
| 443 |
if(!byId.has('report'))byId.set('report',defaultRunDocuments(detail)[2]);
|
| 444 |
if(!byId.has('smoke'))byId.set('smoke',defaultRunDocuments(detail)[3]);
|
| 445 |
-
byId.get('pi_raw_trace').present=Boolean(
|
| 446 |
if(filePaths.has('traces/raw/agent_trace.jsonl'))byId.get('pi_raw_trace').url=defaultRunDocuments(detail)[0].url;
|
| 447 |
-
byId.get('pi_redacted_trace').present=Boolean(
|
| 448 |
if(filePaths.has('traces/redacted/agent_trace.jsonl'))byId.get('pi_redacted_trace').url=defaultRunDocuments(detail)[1].url;
|
| 449 |
byId.get('report').present=Boolean((byId.get('report').present&&byId.get('report').url)||reportText.length||filePaths.has('report.md'));
|
| 450 |
byId.get('smoke').present=Boolean((byId.get('smoke').present&&byId.get('smoke').url)||Object.keys(detail.generation_smoke||{}).length||filePaths.has('tests/generation_smoke.json'));
|
|
|
|
| 275 |
},
|
| 276 |
};
|
| 277 |
}
|
| 278 |
+
function upsertRunExplorerFromProgress(p={}){
|
| 279 |
+
const runId=p.run_id||p.summary?.run_id||state.runId;
|
| 280 |
+
if(!runId)return;
|
| 281 |
+
const summary={
|
| 282 |
+
...(cachedRunById(runId)||{}),
|
| 283 |
+
...(p.summary||{}),
|
| 284 |
+
run_id:runId,
|
| 285 |
+
status:p.view?.header?.status||p.status||p.state?.status||p.summary?.status,
|
| 286 |
+
updated_at:p.state?.updated_at||p.summary?.updated_at||p.updated_at||new Date().toISOString(),
|
| 287 |
+
model_id:p.summary?.model_id||p.state?.model_id||p.model_id,
|
| 288 |
+
target_space:p.summary?.target_space||p.state?.target_space,
|
| 289 |
+
target_space_url:p.summary?.target_space_url||p.links?.space_url||p.view?.links?.space_url,
|
| 290 |
+
selected_hardware:p.summary?.selected_hardware||p.state?.selected_hardware,
|
| 291 |
+
latency_seconds:p.summary?.latency_seconds||p.generation_smoke?.latency_seconds||p.state?.generation_smoke?.latency_seconds,
|
| 292 |
+
observed_latency_seconds:p.summary?.observed_latency_seconds||p.generation_smoke?.observed_latency_seconds||p.generation_smoke?.latency_seconds,
|
| 293 |
+
recommended_zero_gpu_duration_seconds:p.summary?.recommended_zero_gpu_duration_seconds||p.generation_smoke?.recommended_zero_gpu_duration_seconds||p.generation_smoke?.recommended_zerogpu_duration_seconds,
|
| 294 |
+
recommended_zerogpu_duration_seconds:p.summary?.recommended_zerogpu_duration_seconds||p.generation_smoke?.recommended_zerogpu_duration_seconds||p.generation_smoke?.recommended_zero_gpu_duration_seconds,
|
| 295 |
+
kind:p.summary?.kind||p.state?.kind||'universal_model_card_builder',
|
| 296 |
+
bucket_source:p.bucket_source||p.summary?.bucket_source||state.bucketSource,
|
| 297 |
+
};
|
| 298 |
+
state.runsCache=state.runsCache||[];
|
| 299 |
+
const idx=state.runsCache.findIndex(r=>r.run_id===runId);
|
| 300 |
+
if(idx>=0)state.runsCache[idx]={...state.runsCache[idx],...summary};
|
| 301 |
+
else state.runsCache.unshift(summary);
|
| 302 |
+
state.runsLastLoaded=Date.now();
|
| 303 |
+
renderRunsFromCache();
|
| 304 |
+
}
|
| 305 |
function renderRunSelectionPreview(runId){
|
| 306 |
const cached=cachedRunById(runId);
|
| 307 |
if(!cached)return;
|
|
|
|
| 456 |
const files=Array.isArray(detail.files)?detail.files:[];
|
| 457 |
const filePaths=new Set(files.map(f=>String(f.path||'')));
|
| 458 |
const hasPrefix=prefix=>files.some(f=>String(f.path||'').startsWith(prefix.replace(/\/$/,'')+'/'));
|
|
|
|
|
|
|
|
|
|
| 459 |
const reportText=String(detail.report||'');
|
| 460 |
const summary=detail.summary||{};
|
| 461 |
const blockers=detail.technical_blockers||{};
|
|
|
|
| 466 |
if(!byId.has('pi_redacted_trace'))byId.set('pi_redacted_trace',defaultRunDocuments(detail)[1]);
|
| 467 |
if(!byId.has('report'))byId.set('report',defaultRunDocuments(detail)[2]);
|
| 468 |
if(!byId.has('smoke'))byId.set('smoke',defaultRunDocuments(detail)[3]);
|
| 469 |
+
byId.get('pi_raw_trace').present=Boolean(filePaths.has('traces/raw/agent_trace.jsonl')||String(byId.get('pi_raw_trace').url||'').includes('/traces/raw/agent_trace.jsonl'));
|
| 470 |
if(filePaths.has('traces/raw/agent_trace.jsonl'))byId.get('pi_raw_trace').url=defaultRunDocuments(detail)[0].url;
|
| 471 |
+
byId.get('pi_redacted_trace').present=Boolean(filePaths.has('traces/redacted/agent_trace.jsonl')||String(byId.get('pi_redacted_trace').url||'').includes('/traces/redacted/agent_trace.jsonl'));
|
| 472 |
if(filePaths.has('traces/redacted/agent_trace.jsonl'))byId.get('pi_redacted_trace').url=defaultRunDocuments(detail)[1].url;
|
| 473 |
byId.get('report').present=Boolean((byId.get('report').present&&byId.get('report').url)||reportText.length||filePaths.has('report.md'));
|
| 474 |
byId.get('smoke').present=Boolean((byId.get('smoke').present&&byId.get('smoke').url)||Object.keys(detail.generation_smoke||{}).length||filePaths.has('tests/generation_smoke.json'));
|