1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import path from 'path'
const name = 'test'
const cwd = process.env.TEST_CWD || process.cwd() + '/test/module/'
const cpu = {
type: 'perl',
script: 'test.pl',
params: '--train',
listen: (task, line, i) => {
if ( (parseInt(line) % 10) === 0) {
return { type: 'epoch', task, epoch: (i/10)|0 }
}
return null
}
}
const gpu = {
type: 'python',
script: 'test.pl',
params: '--test',
}
const live = {
type: 'python',
script: 'test.py',
live: true,
listen: (task, line, i) => {
if (line.match('orange')) {
return { type: 'progress', task, mode: 'orange', progress: i }
}
if ( (i % 10) === 9) {
return { type: 'epoch', task, epoch: (i/10)|0 }
}
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,
}
}
|