diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 23:45:31 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 23:45:31 +0200 |
| commit | 8850e41b3c51a5d90ca6c1667d6c1b1cebae6ad0 (patch) | |
| tree | 0d92519c3980f83fcb29bffaae674722e9338041 /app/client | |
| parent | 927d75b8d4579f86adb0c3d8f3eb8847924b0c09 (diff) | |
"after" tasks working
Diffstat (limited to 'app/client')
| -rw-r--r-- | app/client/dataset/dataset.loader.js | 7 | ||||
| -rw-r--r-- | app/client/modules/pix2pix/pix2pix.tasks.js | 29 | ||||
| -rw-r--r-- | app/client/system/system.component.js | 10 |
3 files changed, 31 insertions, 15 deletions
diff --git a/app/client/dataset/dataset.loader.js b/app/client/dataset/dataset.loader.js index f068bdb..3887e69 100644 --- a/app/client/dataset/dataset.loader.js +++ b/app/client/dataset/dataset.loader.js @@ -74,7 +74,12 @@ export const load = module => { ungeneratedFiles.reduce((datasetLookup, file) => { fileLookup[file.id] = file if (! file.name) { - file.name = (file.opt || {}).token || file.url + if (file.opt && file.opt.media && file.opt.media.token) { + file.name = file.opt.media.token + } + else { + file.name = file.url.replace(/^https?:\/\/(www.)?/,'').replace(/[^a-zA-Z0-9_]/g, '_').replace(/_+/g, '_') || 'unknown_' + Math.floor(1000*Math.random()) + } } const name = (file.name || 'unsorted').split('.')[0] const folder = folderLookup[file.folder_id] || unsortedFolder(module) diff --git a/app/client/modules/pix2pix/pix2pix.tasks.js b/app/client/modules/pix2pix/pix2pix.tasks.js index db7d4b1..7bfc09f 100644 --- a/app/client/modules/pix2pix/pix2pix.tasks.js +++ b/app/client/modules/pix2pix/pix2pix.tasks.js @@ -5,6 +5,21 @@ import types from '../../types' import actions from '../../actions' +export const fetch_task = (url, file_id, dataset) => dispatch => { + if (! url) return console.log('input file inaccessible (no url)') + const task = { + module: 'pix2pix', + activity: 'fetch', + dataset: dataset, + opt: { + url, + file_id, + dataset, + } + } + return actions.queue.add_task(task) +} + export const live_task = (sequence, checkpoint) => dispatch => { const task = { module: 'pix2pix', @@ -33,20 +48,6 @@ export const live_task = (sequence, checkpoint) => dispatch => { // console.log(task) // return actions.queue.add_task(task) // } -// export const fetch_task = (url, file_id, dataset) => dispatch => { -// if (! url) return console.log('input file inaccessible (no url)') -// const task = { -// module: 'samplernn', -// activity: 'fetch', -// dataset: dataset, -// opt: { -// url, -// file_id, -// dataset, -// } -// } -// return actions.queue.add_task(task) -// } // export const log_task = (dataset) => dispatch => { // const task = { // module: 'samplernn', diff --git a/app/client/system/system.component.js b/app/client/system/system.component.js index 216c7cc..aaa10d6 100644 --- a/app/client/system/system.component.js +++ b/app/client/system/system.component.js @@ -30,6 +30,13 @@ const live_test_task = { epochs: 1, opt: {} } +const wait_test_task = { + activity: 'wait', + module: 'test', + dataset: 'test', + epochs: 1, + opt: {} +} const fruits = ["apple","pear","orange","strawberry"] function choice(a){ return a[Math.floor(Math.random()*a.length)]} @@ -105,6 +112,9 @@ class System extends Component { <Param title=''> <button onClick={() => actions.system.enqueue_test_task(choice(fruits))}>+Add</button> </Param> + <Param title=''> + <button onClick={() => actions.queue.start_task(wait_test_task, { preempt: true, watch: true })}>Wait and Buzz</button> + </Param> </Group> </div> {this.renderCommandOutput()} |
