diff options
Diffstat (limited to 'app/relay')
| -rw-r--r-- | app/relay/remote.js | 2 | ||||
| -rw-r--r-- | app/relay/runner.js | 19 |
2 files changed, 10 insertions, 11 deletions
diff --git a/app/relay/remote.js b/app/relay/remote.js index ff2d32b..e468c7d 100644 --- a/app/relay/remote.js +++ b/app/relay/remote.js @@ -26,7 +26,7 @@ remote.on('cmd', (data) => { break default: rpc.invoke('send_command', data.cmd, data.payload || null, (err, res, more) => { - console.log('sent command', res) + console.log('command:', data.cmd, res) remote.emit('res', { cmd: data.cmd, res: res, diff --git a/app/relay/runner.js b/app/relay/runner.js index 906ddbf..ecdfcde 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -151,18 +151,17 @@ export function run_task(task, preempt, watch){ } task.uuid = task.uuid || uuidv1() - task.processor = interpreter.gpu ? 'gpu' : 'cpu' + const processor = task.processor = interpreter.gpu ? 'gpu' : 'cpu' remote.emit('task_res', { type: 'task_begin', task }) - if (watch) { - console.log("watching stdout..") - subprocess.stdout.on('data', data => { - remote.emit('task_res', { type: 'stdout', data: data.toString('utf8') }) - }) - subprocess.stderr.on('data', data => { - remote.emit('task_res', { type: 'stderr', data: data.toString('utf8') }) - }) - } + watch && console.log("watching stdout..") + + subprocess.stdout.on('data', data => { + watch && remote.emit('task_res', { type: 'stdout', processor, data: data.toString('utf8') }) + }) + subprocess.stderr.on('data', data => { + watch && remote.emit('task_res', { type: 'stderr', processor, data: data.toString('utf8') }) + }) let finished = false |
