summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/client/dataset/dataset.loader.js7
-rw-r--r--app/client/modules/pix2pix/pix2pix.tasks.js29
-rw-r--r--app/client/system/system.component.js10
-rw-r--r--app/relay/modules/test.js12
-rw-r--r--app/relay/runner.js6
5 files changed, 48 insertions, 16 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()}
diff --git a/app/relay/modules/test.js b/app/relay/modules/test.js
index 8876f7c..259e817 100644
--- a/app/relay/modules/test.js
+++ b/app/relay/modules/test.js
@@ -33,10 +33,22 @@ const live = {
return null
}
}
+const wait = {
+ type: 'perl',
+ script: 'test.pl',
+ params: '--wait',
+ after: 'buzz',
+}
+const buzz = {
+ type: 'perl',
+ script: 'test.pl',
+ params: '--buzz',
+}
export default {
name, cwd,
activities: {
cpu, gpu, live,
+ wait, buzz,
}
}
diff --git a/app/relay/runner.js b/app/relay/runner.js
index 1c98977..2459996 100644
--- a/app/relay/runner.js
+++ b/app/relay/runner.js
@@ -318,8 +318,12 @@ export function run_task_with_activity(task, module, activity, preempt=false, wa
set_connected(false)
// remove task from queue
// queue.remove_task(task)
+ console.log('success?', task.success, activity)
if (task.success && activity.after) {
- return run_task_with_activity(task, module, activity.after, preempt, watch)
+ if (activity.after in modules[task.module].activities) {
+ const after_activity = modules[task.module].activities[activity.after]
+ return run_task_with_activity(task, module, after_activity, preempt, watch)
+ }
}
return run_next_task()
}