summaryrefslogtreecommitdiff
path: root/app/relay
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-22 13:02:32 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-22 13:02:32 +0200
commit2925f4043d51fcfd7ef9c139d9205c7f813e7af4 (patch)
tree450deada26e98fa923dbc3b4cd4b1c8c3fa1bf79 /app/relay
parent58a77a6b4986548e04cddd86ee07ea961066b446 (diff)
new way to die
Diffstat (limited to 'app/relay')
-rw-r--r--app/relay/modules/pix2pixhd.js2
-rw-r--r--app/relay/queue.js5
-rw-r--r--app/relay/remote.js2
-rw-r--r--app/relay/runner.js20
4 files changed, 17 insertions, 12 deletions
diff --git a/app/relay/modules/pix2pixhd.js b/app/relay/modules/pix2pixhd.js
index 3613e1c..ccfd334 100644
--- a/app/relay/modules/pix2pixhd.js
+++ b/app/relay/modules/pix2pixhd.js
@@ -116,7 +116,7 @@ const live = {
'--sequence', '--sequence-frac', 0.3,
'--process-frac', 0.5,
'--label_nc', '0', '--no_instance',
- '--how_many', 1000000, '--transition-period', 1000,
+ '--how_many', 10000, '--transition-period', 1000,
'--just-copy', '--poll_delay', opt.poll_delay || 0.09,
'--which_epoch', 'latest',
'--norm', 'batch',
diff --git a/app/relay/queue.js b/app/relay/queue.js
index d6e7ffe..8cd6f61 100644
--- a/app/relay/queue.js
+++ b/app/relay/queue.js
@@ -22,9 +22,9 @@ export class Queue {
this.active = true
this.status = 'active'
}
- deactivate(reason) {
+ deactivate() {
this.active = false
- this.status = reason || 'waiting'
+ this.status = 'waiting'
}
add_task(task){
this.a.push(task)
@@ -40,6 +40,5 @@ export class Queue {
}
}
-
export const cpu = new Queue('cpu')
export const gpu = new Queue('gpu') \ No newline at end of file
diff --git a/app/relay/remote.js b/app/relay/remote.js
index cf941b1..23867c1 100644
--- a/app/relay/remote.js
+++ b/app/relay/remote.js
@@ -70,7 +70,7 @@ remote.on('task', (data) => {
break
case 'stop_queue':
queue = q.get_processor(data_task)
- queue.deactivate('user')
+ queue && queue.deactivate()
break
case 'list':
queue = q.get_processor(data_task)
diff --git a/app/relay/runner.js b/app/relay/runner.js
index 431ed75..6bd33af 100644
--- a/app/relay/runner.js
+++ b/app/relay/runner.js
@@ -368,12 +368,12 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa
let finished = false
subprocess.on('error', (err) => {
- if (finished) return
+ if (finished) return console.log('already finished')
finished = true
task.processing = false
task.completed = true
task.success = false
- console.log('task error', subprocess.exitCode, err)
+ console.log('>>> task error', subprocess.exitCode, err)
finish({
type: 'task_error',
task, err,
@@ -381,10 +381,9 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa
})
subprocess.on('close', () => {
- if (finished) return
+ if (finished) return console.log('already finished')
finished = true
- console.log('task ended', subprocess.exitCode || '')
- set_connected(false)
+ console.log('>>> task ended', subprocess.exitCode || '')
task.processing = false
task.completed = true
task.success = true
@@ -398,7 +397,7 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa
remote.emit('task_res', task_res)
clear_task(interpreter.gpu, task_res.task)
set_connected(false)
- // remove task from queue
+ // remove task from queue..?
// queue.remove_task(task)
console.log('success?', task.success, activity)
if (task.success && activity.after) {
@@ -456,6 +455,13 @@ export function terminate(processor, sigkill=false){
if (sigkill) {
kill(processor.subprocess.pid, 'SIGKILL')
} else {
- kill(processor.subprocess.pid)
+ kill(processor.subprocess.pid, 'SIGTERM', err => {
+ if (err) {
+ console.log(err)
+ }
+ else {
+ console.log('process killed?', processor.subprocess)
+ }
+ })
}
} \ No newline at end of file