diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 21:43:36 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-04 21:43:36 +0200 |
| commit | 5321bafae0916861e270b692a42b3b699a96d339 (patch) | |
| tree | 9137cd8ff869b623bb257a22f29223a2af661a44 /public/bundle.js | |
| parent | 55a5504ab1271bb5cdc3d7d7df5df853b0161148 (diff) | |
task index / queue translation
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 141 |
1 files changed, 66 insertions, 75 deletions
diff --git a/public/bundle.js b/public/bundle.js index c179c73..f117f07 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -2375,6 +2375,10 @@ var _dashboard = __webpack_require__(/*! ./dashboard.actions */ "./app/client/da var dashboardActions = _interopRequireWildcard(_dashboard); +var _actions = __webpack_require__(/*! ../actions */ "./app/client/actions.js"); + +var _actions2 = _interopRequireDefault(_actions); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -2391,7 +2395,10 @@ var Dashboard = function (_Component) { function Dashboard(props) { _classCallCheck(this, Dashboard); - return _possibleConstructorReturn(this, (Dashboard.__proto__ || Object.getPrototypeOf(Dashboard)).call(this)); + var _this = _possibleConstructorReturn(this, (Dashboard.__proto__ || Object.getPrototypeOf(Dashboard)).call(this)); + + _actions2.default.task.index(); + return _this; } _createClass(Dashboard, [{ @@ -2430,31 +2437,7 @@ var Dashboard = function (_Component) { { title: 'Upcoming Tasks' }, (0, _preact.h)(_tasklist2.default, { tasks: queue }) ) - ), - (0, _preact.h)( - 'div', - { className: 'column' }, - (0, _preact.h)( - _group2.default, - { title: 'Your Datasets' }, - (0, _preact.h)(_fileList.FileList, { files: files }) - ), - (0, _preact.h)( - _group2.default, - { title: 'Results' }, - (0, _preact.h)(_fileList.FileList, { files: files }) - ), - (0, _preact.h)( - _group2.default, - { title: 'Audio Player' }, - (0, _preact.h)(_fileList.FileList, { files: files }) - ) ) - ), - (0, _preact.h)( - 'div', - null, - (0, _preact.h)(_gallery2.default, { images: images }) ) ); } @@ -5139,7 +5122,7 @@ var set_folder = exports.set_folder = function set_folder(folder) { var fetch_url = exports.fetch_url = function fetch_url(url) { return function (dispatch) { console.log(url); - _actions2.default.task.start_task({ + return _actions2.default.queue.add_task({ activity: 'fetch', module: 'samplernn', dataset: 'test', @@ -5163,7 +5146,7 @@ var train_task_now = exports.train_task_now = function train_task_now(dataset) { keep_old_checkpoints: false } }; - return _actions2.default.queue.start_task(task); + return _actions2.default.queue.add_task(task); }; }; @@ -6662,7 +6645,7 @@ exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)( Object.defineProperty(exports, "__esModule", { value: true }); -exports.stop_task = exports.start_task = undefined; +exports.add_task = exports.stop_task = exports.start_task = undefined; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; @@ -6674,6 +6657,10 @@ var _types = __webpack_require__(/*! ../types */ "./app/client/types.js"); var _types2 = _interopRequireDefault(_types); +var _actions = __webpack_require__(/*! ../actions */ "./app/client/actions.js"); + +var _actions2 = _interopRequireDefault(_actions); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var start_task = exports.start_task = function start_task(task) { @@ -6690,6 +6677,14 @@ var stop_task = exports.stop_task = function stop_task(task) { return _extends({ type: _types2.default.task.stopping_task, task: task }, opt); }; +var add_task = exports.add_task = function add_task(new_task) { + return function (dispatch) { + _actions2.default.task.create(new_task).then(function (task) { + _socket2.default.task.add_task(task, opt); + }); + }; +}; + /***/ }), /***/ "./app/client/queue/queue.reducer.js": @@ -6706,73 +6701,64 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var _types = __webpack_require__(/*! ../types */ "./app/client/types.js"); var _types2 = _interopRequireDefault(_types); +var _util = __webpack_require__(/*! ../util */ "./app/client/util/index.js"); + +var util = _interopRequireWildcard(_util); + var _moment = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js"); var _moment2 = _interopRequireDefault(_moment); +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + var queueInitialState = { loading: false, error: null, - - queue: [{ - id: 1073, - activity: 'train', - module: 'samplernn', - dataset: 'bobby_brown_-_every_little_step', - epochs: 6 - }, { - id: 1073, - activity: 'train', - module: 'pix2pix', - checkpoint: 'lyra_voice_layers', - dataset: 'audio/lyra_improv', - epochs: 30 - }, { - id: 1073, - activity: 'train', - module: 'pix2pix', - checkpoint: 'lyra_melody_lines', - dataset: 'audio/lyra_improv', - epochs: 30 - }, { - id: 1073, - activity: 'train', - module: 'pix2pix', - checkpoint: 'ensemble_chords', - dataset: 'audio/lyra_improv', - epochs: 30 - }, { - id: 1073, - activity: 'generate', - module: 'samplernn', - dataset: 'coccoglass3', - opt: { time: 5, count: 6 } - }, { - id: 1073, - activity: 'train', - module: 'pix2pix', - dataset: 'video/woods_green', - epochs: 100 - }, { - id: 1073, - activity: 'train', - module: 'samplernn', - dataset: 'bobby_brown_-_every_little_step', - epochs: 6 - }] + tasks: {}, + queue: [], + completed: [] }; +var dateSort = util.sort.orderByFn('date desc'); +var prioritySort = util.sort.orderByFn('priority asc'); + var queueReducer = function queueReducer() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : queueInitialState; var action = arguments[1]; switch (action.type) { + case _types2.default.task.create: + return _extends({}, state, { + tasks: _extends({}, state.tasks, _defineProperty({}, action.data.id, action.data)), + queue: state.queue.concat([action.data]) + }); + case _types2.default.task.index: + console.log(action.data); + return _extends({}, state, { + tasks: action.data.reduce(function (a, b) { + return a[b.id] = b, a; + }, {}), + queue: action.data.filter(function (a) { + return !a.completed; + }).map(dateSort.mapFn).sort(dateSort.sortFn).map(function (pair) { + return pair[1].id; + }), + completed: action.data.filter(function (a) { + return a.completed; + }).map(prioritySort.mapFn).sort(prioritySort.sortFn).map(function (pair) { + return pair[1].id; + }) + }); default: return state; } @@ -8406,6 +8392,11 @@ var orderByFn = exports.orderByFn = function orderByFn() { }; sortFn = numericSort[direction]; break; + case 'priority': + mapFn = function mapFn(a) { + return [parseInt(a.priority) || parseInt(a.id) || 1000, a]; + }; + sortFn = numericSort[direction]; case 'name': default: mapFn = function mapFn(a) { |
