diff options
| author | jules@lens <julescarbon@gmail.com> | 2018-09-05 12:00:28 +0200 |
|---|---|---|
| committer | jules@lens <julescarbon@gmail.com> | 2018-09-05 12:00:28 +0200 |
| commit | 9abfa16dc059d042c21f1636ecc8797ef29a030d (patch) | |
| tree | d0583cb5dae01de1abc57ed8f7587d23242ed6f0 /app/client/socket | |
| parent | 0a3c6743543dd3dfcb876f5ce735b72d050e981d (diff) | |
| parent | 15eb6806b6e216255f33abcb885f6cdbc38a7663 (diff) | |
Merge branch 'master' of asdf.us:live-cortex
Diffstat (limited to 'app/client/socket')
| -rw-r--r-- | app/client/socket/socket.actions.js | 25 | ||||
| -rw-r--r-- | app/client/socket/socket.live.js | 14 |
2 files changed, 20 insertions, 19 deletions
diff --git a/app/client/socket/socket.actions.js b/app/client/socket/socket.actions.js index e15dda2..78b0517 100644 --- a/app/client/socket/socket.actions.js +++ b/app/client/socket/socket.actions.js @@ -1,24 +1,13 @@ import uuidv1 from 'uuid/v1' 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) -} -export function list_sequences(opt) { - return syscall_async('list_sequences', opt).then(res => res.sequences) -} -export function run_script(opt) { - return syscall_async('run_script', opt) -} -export function upload_file(opt) { - return syscall_async('upload_file', opt) -} +export const run_system_command = opt => syscall_async('run_system_command', opt) +export const disk_usage = opt => syscall_async('run_system_command', { cmd: 'du', ...opt }) +export const list_directory = opt => syscall_async('list_directory', opt).then(res => res.files) +export const list_sequences = opt => syscall_async('list_sequences', opt).then(res => res.sequences) +export const run_script = opt => syscall_async('run_script', opt) +export const upload_file = opt => syscall_async('upload_file', opt) + export const syscall_async = (tag, payload, ttl=10000) => { ttl = payload.ttl || ttl return new Promise( (resolve, reject) => { diff --git a/app/client/socket/socket.live.js b/app/client/socket/socket.live.js index fc53eb3..a1a7a3f 100644 --- a/app/client/socket/socket.live.js +++ b/app/client/socket/socket.live.js @@ -27,6 +27,12 @@ socket.on('res', (data) => { checkpoints: data.res, }) break + case 'list_all_checkpoints': + dispatch({ + type: types.socket.list_all_checkpoints, + checkpoints: data.res, + }) + break case 'list_epochs': dispatch({ type: types.socket.list_epochs, @@ -53,10 +59,16 @@ export function list_checkpoints(module) { payload: module, }) } +export function list_all_checkpoints(module) { + socket.emit('cmd', { + cmd: 'list_all_checkpoints', + payload: module, + }) +} export function list_epochs(module, checkpoint_name) { socket.emit('cmd', { cmd: 'list_epochs', - payload: module + '/' + checkpoint_name, + payload: (module === 'pix2pix' || module === 'pix2wav') ? module + '/' + checkpoint_name : checkpoint_name, }) } export function list_sequences(module) { |
