summaryrefslogtreecommitdiff
path: root/app/client/system/system.reducer.js
blob: e5818137080874f1c910003c81dcaf9c544abc4b (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import types from '../types'
import moment from 'moment'
let FileSaver = require('file-saver')

const systemInitialState = {
  loading: false,
  error: null,

  site: {
    name: 'Lens Cortex',
  },
  cmd: {
    loading: false,
    loaded: false,
    name: null,
    error: null,
    stdout: null,
    stderr: null,
  },

  currentTask: {
    id: 1072,
    activity: 'train',
    library: 'pix2pix',
    dataset: 'video/woods_final',
    epoch: 87,
    epochs: 100,
  },
  images: [
    {
      url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2125.png',
    },
    {
      url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2146%20(1).png',
    },
    {
      url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2149.png',
    },
    {
      url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2150.png',
    },
    {
      url: 'https://s3.amazonaws.com/i.asdf.us/bucky/data/4282/woodscaled_4_true_20180521_2146%20(1).png',
    },
  ],
  tasks: [
    {
      id: 1073,
      activity: 'train',
      library: 'pix2pix',
      dataset: 'video/woods_green',
      epochs: 100,
    },
    {
      id: 1073,
      activity: 'train',
      library: 'samplernn',
      dataset: 'bobby_brown_-_every_little_step',
      epochs: 6,
    },
    {
      id: 1073,
      activity: 'train',
      library: 'pix2pix',
      checkpoint: 'lyra_voice_layers',
      dataset: 'audio/lyra_improv',
      epochs: 30,
    },
    {
      id: 1073,
      activity: 'train',
      library: 'pix2pix',
      checkpoint: 'lyra_melody_lines',
      dataset: 'audio/lyra_improv',
      epochs: 30,
    },
    {
      id: 1073,
      activity: 'train',
      library: 'pix2pix',
      checkpoint: 'ensemble_chords',
      dataset: 'audio/lyra_improv',
      epochs: 30,
    },
    {
      id: 1073,
      activity: 'generate',
      library: 'samplernn',
      dataset: 'coccoglass3',
      opt: { time: 5, count: 6 },
    },
    {
      id: 1073,
      activity: 'train',
      library: 'pix2pix',
      dataset: 'video/woods_green',
      epochs: 100,
    },
    {
      id: 1073,
      activity: 'train',
      library: 'samplernn',
      dataset: 'bobby_brown_-_every_little_step',
      epochs: 6,
    },
  ],
  files: [
    { id: 2, library: 'samplernn', checkpoint: 'jwcglassbeat', dataset: 'jwcglassbeat', epoch: 18, duration: 30, batch_size: 5, filename: 'jwcglassbeat-ep18.mp3', size: 3 * 1024 * 1024, date: Date.now(), opt: "{}", }
  ]
}

const systemReducer = (state = systemInitialState, action) => {
  switch(action.type) {
    case types.system.running_command:
      return {
        ...state,
        cmd: {
          loading: true,
          loaded: false,
          name: action.cmd,
          error: null,
          stdout: null,
          stderr: null,
        }
      }
    case types.system.command_output:
      return {
        ...state,
        cmd: {
          loading: false,
          loaded: true,
          name: action.data.cmd,
          error: action.data.error,
          stdout: action.data.stdout,
          stderr: action.data.stderr,
        }
      }
    default:
      return state
  }
}

export default systemReducer