diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:09:50 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:09:50 +0200 |
| commit | f9ad8a4c20554bafaa5961ff44af0cec3f65fdb0 (patch) | |
| tree | 56e28191be4f386001c1771aefd6f2bf4d92d7ee /app | |
| parent | d35e3045c985b4cc2203cefdf520556683fe72fe (diff) | |
try kill
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/modules/pix2wav/views/pix2wav.live.js | 17 | ||||
| -rw-r--r-- | app/relay/remote.js | 2 | ||||
| -rw-r--r-- | app/relay/runner.js | 14 |
3 files changed, 24 insertions, 9 deletions
diff --git a/app/client/modules/pix2wav/views/pix2wav.live.js b/app/client/modules/pix2wav/views/pix2wav.live.js index 0f73a1f..551bcda 100644 --- a/app/client/modules/pix2wav/views/pix2wav.live.js +++ b/app/client/modules/pix2wav/views/pix2wav.live.js @@ -57,6 +57,9 @@ class Pix2WavLive extends Component { interrupt(){ this.props.actions.queue.stop_task('gpu') } + exit(){ + this.props.actions.queue.stop_task('gpu', { sigkill: true }) + } togglePlaying(){ if (this.props.opt.processing) { this.props.actions.live.pause() @@ -79,8 +82,8 @@ class Pix2WavLive extends Component { } // console.log('sequence', this.props.opt) return ( - <div className='app centered'> - <Player width={424} height={256} /> + <div className='app pix2wav centered'> + <Player width={256} height={256} /> <div className='params row'> <div className='column'> <ParamGroup @@ -183,7 +186,7 @@ class Pix2WavLive extends Component { > <Slider live name='sequence_frac' - min={0.0} max={0.5} type='float' + min={0.0} max={1} type='float' /> <Slider live name='process_frac' @@ -277,6 +280,10 @@ class Pix2WavLive extends Component { title={'GPU Busy'} onClick={() => this.interrupt()} >Interrupt</Button> + <Button + title={'Last resort'} + onClick={() => this.exit()} + >Exit</Button> </div> ) } @@ -290,6 +297,10 @@ class Pix2WavLive extends Component { title={'GPU Busy'} onClick={() => this.interrupt()} >Interrupt</Button> + <Button + title={'Last resort'} + onClick={() => this.exit()} + >Exit</Button> </div> ) } diff --git a/app/relay/remote.js b/app/relay/remote.js index 935298a..c958eab 100644 --- a/app/relay/remote.js +++ b/app/relay/remote.js @@ -47,7 +47,7 @@ remote.on('task', (data) => { response = runner.run_task(data.task, data.preempt, data.watch) break case 'stop': - response = runner.stop_task(data.task) + response = runner.stop_task(data.task, data.sigkill) break case 'add': queue.add_task(data.task) diff --git a/app/relay/runner.js b/app/relay/runner.js index 3ad73a2..1c98977 100644 --- a/app/relay/runner.js +++ b/app/relay/runner.js @@ -339,23 +339,27 @@ export function run_next_task(){ } } -export function stop_task(task){ +export function stop_task(task, sigkill){ if (!task) return if (task === 'cpu' || state.current_cpu_task.task.uuid === task.uuid) { - terminate(state.current_cpu_task) + terminate(state.current_cpu_task, sigkill) return { status: 'ok' } } else if (task === 'gpu' || state.current_gpu_task.task.uuid === task.uuid) { - terminate(state.current_gpu_task) + terminate(state.current_gpu_task, sigkill) return { status: 'ok' } } return { error: 'no such task' } } -export function terminate(processor){ +export function terminate(processor, sigkill=false){ if (!processor || !processor.subprocess) { return } console.log('kill pid', processor.subprocess.pid) processor.task.cancelled = true - kill(processor.subprocess.pid) + if (sigkill) { + kill(processor.subprocess.pid, 'SIGKILL') + } else { + kill(processor.subprocess.pid) + } }
\ No newline at end of file |
