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
|
import { h, Component } from 'preact'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import util from '../util'
// import { Loading, CurrentTask, FileList, FileRow } from '../../../common'
function CurrentTask ({ cpu, gpu, processor }) {
const processor_name = processor === 'cpu' ? 'cpu' : 'gpu'
const p = processor === 'cpu' ? cpu : gpu
if (!p) return <div></div>
if (p.status === 'IDLE') {
return <div>{processor_name} idle</div>
}
const { last_message, pid, task } = p
const { activity, epoch, epochs, dataset, module } = task
return (
<div>
#{pid}: <b>{module} {activity}</b> <i>{dataset}</i> {epochs} epoch{util.courtesy_s(epochs)} (currently #{epoch})
<br/><br/>
<div class='quiet'>{last_message}</div>
</div>
)
}
const mapStateToProps = state => state.system.runner
const mapDispatchToProps = (dispatch, ownProps) => ({
// actions: bindActionCreators(samplernnActions, dispatch),
// remote: bindActionCreators(samplernnTasks, dispatch),
// audioPlayer: bindActionCreators(audioPlayerActions, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(CurrentTask)
|