summaryrefslogtreecommitdiff
path: root/app/relay
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
commit2664eb3e474f5d03d1782c15673b774d68fb2c58 (patch)
tree1f1e58a6090f6befa75d8f6915388ddee30df04d /app/relay
parent3a8d99c5e4f64a9426585943c40635eb183b47ae (diff)
textInput/fileUpload
Diffstat (limited to 'app/relay')
-rw-r--r--app/relay/remote.js2
-rw-r--r--app/relay/runner.js19
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