diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 22:56:28 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 22:56:28 +0200 |
| commit | 1ccc4c798d95133cde1d4558318f0640a772526a (patch) | |
| tree | ad71fbe1e341abafcd73b2c6e84a76c532fd9bf5 /app | |
| parent | a0b596b2d675144cbb00e55e67a79743166e25a5 (diff) | |
pushing test tasks into queue
Diffstat (limited to 'app')
| -rw-r--r-- | app/client/dashboard/dashboard.component.js | 4 | ||||
| -rw-r--r-- | app/client/dashboard/tasklist.component.js | 3 | ||||
| -rw-r--r-- | app/client/queue/queue.actions.js | 2 | ||||
| -rw-r--r-- | app/client/queue/queue.reducer.js | 4 | ||||
| -rw-r--r-- | app/client/system/system.actions.js | 11 | ||||
| -rw-r--r-- | app/client/system/system.component.js | 3 | ||||
| -rw-r--r-- | app/relay/remote.js | 2 |
7 files changed, 23 insertions, 6 deletions
diff --git a/app/client/dashboard/dashboard.component.js b/app/client/dashboard/dashboard.component.js index 0081d67..64a8848 100644 --- a/app/client/dashboard/dashboard.component.js +++ b/app/client/dashboard/dashboard.component.js @@ -36,12 +36,12 @@ class Dashboard extends Component { <div className='column'> {!!queue.completed.length && <Group title='Completed Tasks'> - <TaskList tasks={queue.completed.map(id => task.id)} /> + <TaskList tasks={queue.completed.map(id => tasks[id])} /> </Group> } {!!queue.queue.length && <Group title='Upcoming Tasks'> - <TaskList tasks={queue.queue.map(id => task.id)} /> + <TaskList tasks={queue.queue.map(id => tasks[id])} /> </Group> } </div> diff --git a/app/client/dashboard/tasklist.component.js b/app/client/dashboard/tasklist.component.js index e5b1171..487e73d 100644 --- a/app/client/dashboard/tasklist.component.js +++ b/app/client/dashboard/tasklist.component.js @@ -10,6 +10,7 @@ class TaskList extends Component { const { title, tasks } = this.props let time = 0 const taskList = tasks.map(task => { + console.log(task) const eta = (time + (task.epochs) * 180 / 60) + " min." time += (task.epochs) * 180 / 60 let dataset_type, dataset_name @@ -22,7 +23,7 @@ class TaskList extends Component { <div class='row'> <div class='activity'>{task.activity} {task.module} {dataset_type}</div> <div class='dataset'>{dataset_name}</div> - <div class='epochs'>{task.epochs} ep.</div> + <div class='epochs'>{task.epoch} ep.</div> <div class='eta'>{eta}</div> </div> ) diff --git a/app/client/queue/queue.actions.js b/app/client/queue/queue.actions.js index 3450ecc..1885e2c 100644 --- a/app/client/queue/queue.actions.js +++ b/app/client/queue/queue.actions.js @@ -16,6 +16,6 @@ export const stop_task = (task, opt={}) => { export const add_task = (new_task) => (dispatch) => { actions.task.create(new_task) .then((task) => { - socket.task.add_task(task, opt) + socket.task.add_task(task) }) }
\ No newline at end of file diff --git a/app/client/queue/queue.reducer.js b/app/client/queue/queue.reducer.js index 05cd015..3dc4db3 100644 --- a/app/client/queue/queue.reducer.js +++ b/app/client/queue/queue.reducer.js @@ -16,16 +16,16 @@ const prioritySort = util.sort.orderByFn('priority asc') const queueReducer = (state = queueInitialState, action) => { switch(action.type) { case types.task.create: + console.log(action.data) return { ...state, tasks: { ...state.tasks, [action.data.id]: action.data, }, - queue: state.queue.concat([action.data]), + queue: state.queue.concat([action.data.id]), } case types.task.index: - console.log(action.data) return { ...state, tasks: action.data.reduce((a,b) => (a[b.id] = b, a), {}), diff --git a/app/client/system/system.actions.js b/app/client/system/system.actions.js index 9e4f178..c661769 100644 --- a/app/client/system/system.actions.js +++ b/app/client/system/system.actions.js @@ -1,6 +1,8 @@ import socket from '../socket' import types from '../types' +import actions from '../actions' + export const run = (cmd) => (dispatch) => { dispatch({ type: types.system.running_command, cmd }) socket.actions.run_system_command(cmd) @@ -26,3 +28,12 @@ export const listDirectory = (opt) => (dispatch) => { export const changeTool = (tool) => { return { type: types.app.change_tool, tool } } + +export const enqueue_test_task = (dataset) => dispatch => { + const task = { + module: 'test', + activity: 'test', + dataset: dataset, + } + return actions.queue.add_task(task) +} diff --git a/app/client/system/system.component.js b/app/client/system/system.component.js index 1953ee3..b4a0ed7 100644 --- a/app/client/system/system.component.js +++ b/app/client/system/system.component.js @@ -93,6 +93,9 @@ 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.system.enqueue_test_task(choice(fruits))}>+ Add</button> + </Param> </Group> </div> {this.renderCommandOutput()} diff --git a/app/relay/remote.js b/app/relay/remote.js index 13a613c..6fee366 100644 --- a/app/relay/remote.js +++ b/app/relay/remote.js @@ -1,5 +1,7 @@ import { rpc, get_connected } from './rpc' +import * as queue from './queue' + const io = require('socket.io-client') const runner = require('./runner') |
