diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/dashboard/dashboard.component.js | 2 | ||||
| -rw-r--r-- | app/client/modules/pix2pix/live.component.js | 2 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.actions.js | 6 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.new.js | 6 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.results.js | 7 | ||||
| -rw-r--r-- | app/client/modules/samplernn/samplernn.show.js | 2 | ||||
| -rw-r--r-- | app/client/socket/socket.actions.js | 3 | ||||
| -rw-r--r-- | app/client/system/system.actions.js | 2 | ||||
| -rw-r--r-- | app/client/system/system.component.js | 3 | ||||
| -rw-r--r-- | app/client/system/system.reducer.js | 2 | ||||
| -rw-r--r-- | app/relay/runner.js | 21 |
11 files changed, 40 insertions, 16 deletions
diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index 64a8848..4b3d077 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -30,7 +30,7 @@ class Dashboard extends Component { const { site, queue, images } = this.props const { tasks } = queue return ( - <div className='dashboard'> + <div className='app dashboard'> <DashboardHeader /> <div className='params'> <div className='column'> diff --git a/app/client/modules/pix2pix/live.component.js b/app/client/modules/pix2pix/live.component.js index 9aef297..82f315c 100644 --- a/app/client/modules/pix2pix/live.component.js +++ b/app/client/modules/pix2pix/live.component.js @@ -61,7 +61,7 @@ class LivePix2Pix extends Component { } render(){ return ( - <div className='app'> + <div className='app centered'> <Player width={424} height={256} /> <div className='params row'> <div className='column'> diff --git a/app/client/modules/samplernn/samplernn.actions.js b/app/client/modules/samplernn/samplernn.actions.js index ef3e417..357617a 100644 --- a/app/client/modules/samplernn/samplernn.actions.js +++ b/app/client/modules/samplernn/samplernn.actions.js @@ -17,12 +17,15 @@ export const load_directories = (id) => (dispatch) => { actions.socket.list_directory({ module: 'samplernn', dir: 'datasets' }), actions.socket.list_directory({ module: 'samplernn', dir: 'results' }), actions.socket.list_directory({ module: 'samplernn', dir: 'output' }), + actions.socket.disk_usage({ module: 'samplernn', dir: 'datasets' }), load_loss()(dispatch), ], (percent, i, n) => { dispatch({ type: types.app.load_progress, progress: { i, n }}) }).then(res => { // console.log(res) - const [folders, files, tasks, datasets, results, output, lossReport] = res + const [folders, files, tasks, datasets, results, output, datasetUsage, lossReport] = res + + console.log(datasetUsage) const unsortedFolder = { id: 0, @@ -265,6 +268,7 @@ export const import_files = (state, datasetLookup, fileLookup) => (dispatch) => console.log(promises) return Promise.all(promises).then(data => { console.log(data) + window.location.href = '/samplernn/datasets/' + folder.id }).catch(e => { console.error(e) }) diff --git a/app/client/modules/samplernn/samplernn.new.js b/app/client/modules/samplernn/samplernn.new.js index 8d8b68c..a6e4fd3 100644 --- a/app/client/modules/samplernn/samplernn.new.js +++ b/app/client/modules/samplernn/samplernn.new.js @@ -20,7 +20,11 @@ class SampleRNNNew extends Component { } render(){ const { history } = this.props - return <NewDatasetForm module={samplernnModule} history={history} /> + return ( + <div class='app samplernn'> + <NewDatasetForm module={samplernnModule} history={history} /> + </div> + ) } } const mapStateToProps = state => ({ diff --git a/app/client/modules/samplernn/samplernn.results.js b/app/client/modules/samplernn/samplernn.results.js index d12e856..31079ce 100644 --- a/app/client/modules/samplernn/samplernn.results.js +++ b/app/client/modules/samplernn/samplernn.results.js @@ -54,13 +54,12 @@ class SampleRNNResults extends Component { }) return ( - <div className='app top left'> - <div className='heading'> + <div className='app samplernn'> + <div className='heading row middle'> <h1>SampleRNN Results</h1> + <Link to='/samplernn/new/'>new project</Link> </div> <div class='rows params renders'> - <Link to='/samplernn/new/'>new dataset</Link> - <br/><br/> {renders} </div> </div> diff --git a/app/client/modules/samplernn/samplernn.show.js b/app/client/modules/samplernn/samplernn.show.js index 1237d9b..982ec53 100644 --- a/app/client/modules/samplernn/samplernn.show.js +++ b/app/client/modules/samplernn/samplernn.show.js @@ -30,7 +30,7 @@ class SampleRNNShow extends Component { const { folderLookup } = (samplernn.data || {}) const folder = (folderLookup || {})[samplernn.folder_id] || {} return ( - <div className='app'> + <div className='app samplernn'> <div class='heading'> <div class='spaced'> <h1>{folder ? folder.name : <Loading />}</h1> diff --git a/app/client/socket/socket.actions.js b/app/client/socket/socket.actions.js index ffe1cfe..38c1b7f 100644 --- a/app/client/socket/socket.actions.js +++ b/app/client/socket/socket.actions.js @@ -4,6 +4,9 @@ import { socket } from './socket.connection' export function run_system_command(opt) { return syscall_async('run_system_command', opt) } +export function disk_usage(opt) { + return syscall_async('run_system_command', { cmd: 'du', ...opt }) +} export function list_directory(opt) { return syscall_async('list_directory', opt).then(res => res.files) } diff --git a/app/client/system/system.actions.js b/app/client/system/system.actions.js index 7039ff2..8758715 100644 --- a/app/client/system/system.actions.js +++ b/app/client/system/system.actions.js @@ -5,7 +5,7 @@ import actions from '../actions' export const run = (cmd) => (dispatch) => { dispatch({ type: types.system.running_command, cmd }) - socket.actions.run_system_command(cmd) + socket.actions.run_system_command({ cmd }) .then(data => { dispatch({ type: types.system.command_output, diff --git a/app/client/system/system.component.js b/app/client/system/system.component.js index 10ec971..216c7cc 100644 --- a/app/client/system/system.component.js +++ b/app/client/system/system.component.js @@ -45,11 +45,10 @@ class System extends Component { render(){ const { site, server, relay, runner, rpc, actions } = this.props return ( - <div className='system'> + <div className='app system'> <div className='heading'> <h1>{site.name} system</h1> </div> - <div className='row params'> <div className='column'> <Group title="Status"> diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js index 8378bf3..961db74 100644 --- a/app/client/system/system.reducer.js +++ b/app/client/system/system.reducer.js @@ -126,7 +126,7 @@ const systemReducer = (state = systemInitialState, action) => { connected: false, error: null, }, - runner: action.runner, + runner: action.runner || state.runner, } case types.system.load_site: document.querySelector('title').innerHTML = action.site.name + '.cortex' diff --git a/app/relay/runner.js b/app/relay/runner.js index 6cb582d..99f4a16 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -121,17 +121,23 @@ export function build_params(module, activity, task) { } export function run_system_command(cmd, cb) { - console.log('running system command:', cmd) - switch(cmd) { + console.log('running system command:', cmd.cmd) + switch(cmd.cmd) { case 'nvidia-smi': case 'ps': case 'uptime': case 'w': - execFile(cmd, [], cb) + execFile(cmd.cmd, [], cb) break case 'df': execFile('df', ['-h'], cb) break + case 'ls': + list_directory(cmd, cb) + break + case 'du': + disk_usage(cmd, cb) + break default: cb({ error: 'no such command' }) break @@ -167,6 +173,15 @@ export function list_directory(opt, cb) { }) } +export function disk_usage(opt, cb) { + if (!opt.module || ! modules[opt.module]) { + cb([]) + } + const module = modules[opt.module] + const dir = path.join(module.cwd, opt.dir.replace(/\.\.?\//g, '')) + execFile('du', ['-d', 1, dir], cb) +} + export function run_script(task, cb) { if (!task.module || ! modules[task.module]) { cb("") |
