From 932fe9ccb9bfad7f454c5f53d35ec06c27328281 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 30 Jun 2018 19:12:58 +0200 Subject: fixing up dashboard --- app/client/dashboard/dashboard.actions.js | 5 ++-- app/client/dashboard/dashboard.component.js | 32 +++++++++-------------- app/client/dashboard/dashboardHeader.component.js | 22 +++++++--------- app/relay/runner.js | 10 +++---- 4 files changed, 29 insertions(+), 40 deletions(-) (limited to 'app') diff --git a/app/client/dashboard/dashboard.actions.js b/app/client/dashboard/dashboard.actions.js index 2757830..8b5502a 100644 --- a/app/client/dashboard/dashboard.actions.js +++ b/app/client/dashboard/dashboard.actions.js @@ -10,7 +10,7 @@ export const load = () => (dispatch) => { actions.file.index({ module: 'pix2pixhd', generated: 1, limit: 15, orderBy: 'created_at desc', }), actions.file.index({ module: 'morph', generated: 1, limit: 15, orderBy: 'created_at desc', }), ], (percent, i, n) => { - console.log('dashboard load progress', i, n) + // console.log('dashboard load progress', i, n) dispatch({ type: types.app.load_progress, progress: { i, n }}) }).then(res => { const [ tasks, folders, samplernn, pix2pixhd, morph ] = res @@ -26,14 +26,13 @@ export const load = () => (dispatch) => { data: { tasks, folders, + foldersByModule, renders: { samplernn, pix2pixhd, morph, }, - foldersByModule, }, }) - }) } diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index a75535f..3c9b2de 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -32,18 +32,16 @@ class Dashboard extends Component { render(){ const { site, foldersByModule, renders, queue, images } = this.props const { tasks } = queue + console.log(foldersByModule) const folders = foldersByModule && Object.keys(modules).sort().map(key => { - let path, folder_list - if (foldersByModule[key]) { - path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' - folder_list = foldersByModule[key].map(folder => { - return ( -
- {folder.name} -
- ) - }) - } + let path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' + let folder_list = (foldersByModule[key] || []).map(folder => { + return ( +
+ {folder.name} +
+ ) + }) let files = renders[key] && (

{key}

- {folder_list && - -
- new -
- {folders} -
- } +
+ new +
+ {folder_list}
{files} diff --git a/app/client/dashboard/dashboardHeader.component.js b/app/client/dashboard/dashboardHeader.component.js index 10b2241..5f1306c 100644 --- a/app/client/dashboard/dashboardHeader.component.js +++ b/app/client/dashboard/dashboardHeader.component.js @@ -13,43 +13,39 @@ class DashboardHeader extends Component { this.props.onClick && this.props.onClick() } render() { - const { site } = this.props + const { site, runner } = this.props return (

{site.name} cortex

- {this.renderGPUStatus()} + {this.renderStatus("GPU", runner.gpu)} + {this.renderStatus("CPU", runner.cpu)}
) } - renderGPUStatus(){ - const { runner } = this.props - const gpu = runner.cpu + renderStatus(name, gpu){ + console.log(gpu) if (gpu.status === 'IDLE') { - return null + return
{name} idle
} const task = gpu.task - const eta = task.epoch - ? ((task.epochs - (task.epoch || 0)) * 1000 / 60) + " minutes" - : null let activityPhrase, liveMessage if (task.activity === 'live') { return (
- Currently running {task.module} live on "{task.dataset}" + {name} running {task.module} live on "{task.dataset}"
) } else { return (
- Currently {util.gerund(task.activity)} {task.module} on {task.dataset}
- {eta && Epoch: {task.epoch} / {task.epochs}, ETA {eta}
} + {name} {util.gerund(task.activity)} {task.module} on {task.dataset} + {!!task.epoch && Epoch: {task.epoch} / {task.epochs}
}
) } } } -// Want to play live? const mapStateToProps = state => ({ runner: state.system.runner, diff --git a/app/relay/runner.js b/app/relay/runner.js index c7c3166..994dcd4 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -395,7 +395,7 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa }) }) - function finish(task_res){ + function finish (task_res) { remote.emit('task_res', task_res) clear_task(interpreter.gpu, task_res.task) set_connected(false) @@ -416,13 +416,13 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa return task } -export function start_queue(){ +export function start_queue () { console.log('starting queue!') const res = run_next_task() console.log(res) } -export function run_next_task(){ +export function run_next_task () { const status = [q.cpu, q.gpu].map(queue => { const status = queue.processor === 'gpu' ? state.current_gpu_task.status : state.current_cpu_task.status console.log(queue.is_active(), status) @@ -438,7 +438,7 @@ export function run_next_task(){ return status } -export function stop_task(task, sigkill){ +export function stop_task (task, sigkill) { if (!task) return { error: 'no such task' } if (task === 'cpu' || (task.uuid && state.current_cpu_task.task.uuid === task.uuid)) { console.log('stop cpu task') @@ -453,7 +453,7 @@ export function stop_task(task, sigkill){ return { error: 'no such task' } } -export function terminate(processor, sigkill=false){ +export function terminate (processor, sigkill=false) { if (!processor || !processor.subprocess) { console.log('nothing running on', processor) return -- cgit v1.2.3-70-g09d2