summaryrefslogtreecommitdiff
path: root/app/client/system
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-05 03:43:09 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-05 03:43:09 +0200
commit4298d8d81c9bea0fb4c0f115dfa2b04ea72f0006 (patch)
tree27ca33f462123757e541b4eef080d834e18ceb1d /app/client/system
parent51d9212d97e3b326a8e9e6499bc83d27df2ef64c (diff)
kill cleanly
Diffstat (limited to 'app/client/system')
-rw-r--r--app/client/system/system.component.js14
-rw-r--r--app/client/system/system.reducer.js16
2 files changed, 21 insertions, 9 deletions
diff --git a/app/client/system/system.component.js b/app/client/system/system.component.js
index bf77237..10ec971 100644
--- a/app/client/system/system.component.js
+++ b/app/client/system/system.component.js
@@ -76,6 +76,16 @@ class System extends Component {
<button onClick={() => actions.system.run('df')}>df</button>
</Param>
</Group>
+ <Group title="Tasks">
+ <Param title='Kill task'>
+ <button onClick={() => actions.queue.stop_task('cpu')}>CPU</button>
+ <button onClick={() => actions.queue.stop_task('gpu')}>GPU</button>
+ </Param>
+ <Param title='Queue'>
+ <button onClick={() => actions.queue.start_queue()}>Start</button>
+ <button onClick={() => actions.queue.stop_queue()}>Stop</button>
+ </Param>
+ </Group>
<Group title="Test">
<Param title='CPU Test Task'>
<button onClick={() => actions.queue.start_task(cpu_test_task, { preempt: true, watch: true })}>Start</button>
@@ -93,10 +103,6 @@ class System extends Component {
<button onClick={() => actions.live.get_params()}>Get</button>
<button onClick={() => actions.live.set_param('fruit', choice(fruits))}>Set</button>
</Param>
- <Param title='Queue'>
- <button onClick={() => actions.queue.start_queue()}>Start</button>
- <button onClick={() => actions.queue.stop_queue()}>Stop</button>
- </Param>
<Param title=''>
<button onClick={() => actions.system.enqueue_test_task(choice(fruits))}>+Add</button>
</Param>
diff --git a/app/client/system/system.reducer.js b/app/client/system/system.reducer.js
index 27c248a..c20bf93 100644
--- a/app/client/system/system.reducer.js
+++ b/app/client/system/system.reducer.js
@@ -44,6 +44,7 @@ const systemInitialState = {
}
const systemReducer = (state = systemInitialState, action) => {
+ let processor = null
switch(action.type) {
case types.socket.connect:
case types.socket.reconnecting:
@@ -174,8 +175,13 @@ const systemReducer = (state = systemInitialState, action) => {
stderr: "",
}
case types.task.task_finish:
- if (state.runner[action.task.processor].task.uuid !== action.task.uuid) {
- return state
+ if (state.runner.cpu.task.uuid === action.task.uuid) {
+ processor = 'cpu'
+ }
+ else if (state.runner.gpu.task.uuid === action.task.uuid) {
+ processor = 'gpu'
+ } else {
+ processor = null
}
return {
...state,
@@ -184,10 +190,10 @@ const systemReducer = (state = systemInitialState, action) => {
status: "disconnected",
error: null,
},
- runner: {
+ runner: processor ? {
...state.runner,
- [action.task.processor]: { status: 'IDLE', task: {} },
- },
+ [processor]: { status: 'IDLE', task: {} },
+ } : state.runner,
}
case types.app.change_tool:
return {