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 }) { let processor_name if (processor) { processor_name = processor === 'cpu' ? 'cpu' : 'gpu' } else if (gpu.status !== 'IDLE') { processor_name = 'gpu' } else if (cpu.status !== 'IDLE') { processor_name = 'cpu' } const p = processor_name === 'cpu' ? cpu : gpu if (!p) return
if (p.status === 'IDLE') { return
{processor_name} idle
} const { last_message, pid, task } = p const { activity, epoch, epochs, dataset, module } = task return (
#{pid}: {module} {activity} {dataset} {epochs ? {epochs} epoch{util.courtesy_s(epochs)} : ""} {epoch ? (currently #{epoch}) : ""}

{last_message}
) } 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)