diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-30 19:12:58 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-30 19:12:58 +0200 |
| commit | 932fe9ccb9bfad7f454c5f53d35ec06c27328281 (patch) | |
| tree | faa0114066ec8fd277f8d2342a2aa6805a3de00d | |
| parent | 03cb68127c7d52642b164a845989f82ab037de7c (diff) | |
fixing up dashboard
| -rw-r--r-- | app/client/dashboard/dashboard.actions.js | 5 | ||||
| -rw-r--r-- | app/client/dashboard/dashboard.component.js | 32 | ||||
| -rw-r--r-- | app/client/dashboard/dashboardHeader.component.js | 22 | ||||
| -rw-r--r-- | app/relay/runner.js | 10 | ||||
| -rw-r--r-- | public/assets/css/css.css | 7 |
5 files changed, 36 insertions, 40 deletions
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 ( - <div key={folder.id}> - <Link to={path + folder.id + '/'}>{folder.name}</Link> - </div> - ) - }) - } + let path = key === 'samplernn' ? '/samplernn/datasets/' : '/' + key + '/sequences/' + let folder_list = (foldersByModule[key] || []).map(folder => { + return ( + <div key={folder.id}> + <Link to={path + folder.id + '/'}>{folder.name}</Link> + </div> + ) + }) let files = renders[key] && ( <FileList @@ -64,14 +62,10 @@ class Dashboard extends Component { <div className='dashboardModule' key={key}> <div className='row moduleHeading'> <h3>{key}</h3> - {folder_list && - <span> - <div> - <Link to={'/' + key + '/new/'}>new</Link> - </div> - {folders} - </span> - } + <div> + <Link to={'/' + key + '/new/'}>new</Link> + </div> + {folder_list} </div> {files} </div> 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 ( <div class='dashboardHeader heading'> <h1>{site.name} cortex</h1> - {this.renderGPUStatus()} + {this.renderStatus("GPU", runner.gpu)} + {this.renderStatus("CPU", runner.cpu)} </div> ) } - renderGPUStatus(){ - const { runner } = this.props - const gpu = runner.cpu + renderStatus(name, gpu){ + console.log(gpu) if (gpu.status === 'IDLE') { - return null + return <div>{name} idle</div> } 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 ( <div> - Currently running {task.module} live on "{task.dataset}" + {name} running <b>{task.module}</b> live on "{task.dataset}" </div> ) } else { return ( <div> - Currently {util.gerund(task.activity)} {task.module} on {task.dataset}<br/> - {eta && <span>Epoch: {task.epoch} / {task.epochs}, ETA {eta}<br/></span>} + {name} {util.gerund(task.activity)} <b>{task.module}</b> on <b>{task.dataset}</b> + {!!task.epoch && <span>Epoch: {task.epoch} / {task.epochs}<br/></span>} </div> ) } } } -// Want to play live? <button>Pause at the end of this epoch</button> 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 diff --git a/public/assets/css/css.css b/public/assets/css/css.css index 7c250d2..3e815af 100644 --- a/public/assets/css/css.css +++ b/public/assets/css/css.css @@ -571,9 +571,16 @@ section { } /* dashboard */ +.dashboardHeader > div { + margin-top: 5px; +} .dashboardModule { margin-bottom: 10px; } +.moduleHeading { + justify-content: flex-start; + align-items: center; +} .moduleHeading div { margin-left: 3px; } |
