Skip to content

Commit

Permalink
Merge pull request #241 from Kitware/scheduler-options
Browse files Browse the repository at this point in the history
Scheduler options
  • Loading branch information
jourdain committed Mar 15, 2016
2 parents 33f0a03 + 2f05afb commit 5303502
Show file tree
Hide file tree
Showing 31 changed files with 512 additions and 217 deletions.
15 changes: 3 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
module.exports = {
extends: 'airbnb',
rules: {
'array-bracket-spacing': 0,
'guard-for-in': 0,
'max-len': [1, 160, 4, {"ignoreUrls": true}],
'no-alert': 0,
'no-console': 0,
'no-multi-spaces': 0,
'no-multi-spaces': [2, { exceptions: { "ImportDeclaration": true } }],
'no-nested-ternary': 0,
'no-param-reassign': 0,
'no-throw-literal': 0,
'no-param-reassign': [2, { props: false }],
'no-unused-vars': [2, { args: 'none' }],
'no-var': 0,
'react/jsx-closing-bracket-location': 1,
'react/jsx-indent-props': 1,
'react/jsx-space-before-closing': 1,
'one-var': 0,
'react/no-is-mounted': 1,
'react/prefer-es6-class': 0,
'react/sort-comp': 0,
'spaced-comment': 1,
'one-var': 0,
}
};
86 changes: 43 additions & 43 deletions dist/HPCCloud.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/network/TaskflowManager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ client.onEvent((resp) => {
// if nothing was updated check the endpoints for new items.
if (!obj) {
// Let's refresh all taskflows
for (const taskflowId in taskflows) {
updateTaskFlow(taskflowId);
}
Object.keys(taskflows).forEach(id => {
updateTaskFlow(id);
});
}
});

Expand Down
7 changes: 4 additions & 3 deletions src/network/remoteClient/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function createItemForProject(project, name, file) {
});
}

export function saveProject(project, attachments) {
export function saveProject(project_, attachments) {
var project = project_;
if (!project._id) {
let folder;
let outputFolder;
Expand Down Expand Up @@ -72,9 +73,9 @@ export function saveProject(project, attachments) {
.then((resp) => {
if (attachments) {
const promises = [];
for (const file in attachments) {
Object.keys(attachments).forEach(file => {
promises.push(createItemForProject(project, file, attachments[file]));
}
});
promises.push(project);
return Promise.all(promises);
}
Expand Down
7 changes: 4 additions & 3 deletions src/network/remoteClient/Simulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function addEmptyFileForSimulation(simulation, name) {

// if there's not a sim.id, create a sim with two folders input and output
// otherwise update simulation
export function saveSimulation(simulation, attachments) {
export function saveSimulation(simulation_, attachments) {
var simulation = simulation_;
if (!simulation._id) {
let folder;
let outputFolder;
Expand Down Expand Up @@ -88,9 +89,9 @@ export function saveSimulation(simulation, attachments) {
.then((resp) => {
if (attachments) {
const promises = [];
for (const file in attachments) {
Object.keys(attachments).forEach(file => {
promises.push(createItemForSimulation(simulation, file, attachments[file]));
}
});
promises.push(simulation);
return Promise.all(promises);
}
Expand Down
70 changes: 23 additions & 47 deletions src/pages/Preferences/Cluster/ClusterForm.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import deepEquals from 'mout/src/lang/deepEquals';
import React from 'react';
import Workflows from '../../../workflows';
import FormPanel from '../../../panels/FormPanel';
import deepEquals from 'mout/src/lang/deepEquals';
import React from 'react';
import Workflows from '../../../workflows';
import FormPanel from '../../../panels/FormPanel';
import SchedulerConfig from '../../../panels/SchedulerConfig';
import CollapsibleWidget from 'paraviewweb/src/React/Widgets/CollapsibleWidget';

import CollapsibleWidget from 'paraviewweb/src/React/Widgets/CollapsibleWidget';

import style from 'HPCCloudStyle/ItemEditor.mcss';
import style from 'HPCCloudStyle/ItemEditor.mcss';

const preventDefault = (e) => { e.preventDefault(); };

const allConfigs = {};
const wfNames = [];

for (const wfName in Workflows) {
Object.keys(Workflows).forEach(wfName => {
const wf = Workflows[wfName];
allConfigs[wfName] = {};
let foundConfig = false;
if (wf.config && wf.config.cluster) {
for (const propKey in wf.config.cluster) {
Object.keys(wf.config.cluster).forEach(propKey => {
allConfigs[wfName][propKey] = wf.config.cluster[propKey];
foundConfig = true;
}
});
}
if (foundConfig) {
wfNames.push(wfName);
}
}
});

export default React.createClass({

Expand Down Expand Up @@ -74,6 +74,17 @@ export default React.createClass({
}
},

updateConfig(scheduler) {
const config = Object.assign(
{},
this.state.data.config,
{ scheduler: Object.assign({}, this.state.data.config.scheduler, scheduler) });

console.log(scheduler, '=>', config);

this.mergeData({ config });
},

mergeData(updatedData) {
const data = Object.assign({}, this.state.data, updatedData);
this.setState({ data });
Expand Down Expand Up @@ -133,42 +144,7 @@ export default React.createClass({
required
/>
</section>
<section className={style.group}>
<label className={style.label}>Number of Slots</label>
<input
className={style.input}
type="text"
value={this.state.data.config.numberOfSlots}
data-key="config.numberOfSlots"
onChange={this.formChange}
required
/>
</section>
<section className={style.group}>
<label className={style.label}>Parallel Environment</label>
<input
className={style.input}
type="text"
value={this.state.data.config.parallelEnvironment}
data-key="config.parallelEnvironment"
onChange={this.formChange}
required
/>
</section>
<section className={style.group}>
<label className={style.label}>Scheduler</label>
<select
className={style.input}
value={this.state.data.config.scheduler.type}
data-key="config.scheduler.type"
onChange={this.formChange}
required
>
<option value="sge">Sun Grid Engine</option>
<option value="pbs">PBS</option>
<option value="slurm">SLURM</option>
</select>
</section>
<SchedulerConfig config={ this.state.data.config.scheduler } onChange={ this.updateConfig } />
{ this.state.data.status !== 'running' ? null :
<section className={style.group}>
<label className={style.label}>Public SSH key</label>
Expand Down
1 change: 1 addition & 0 deletions src/pages/Preferences/Cluster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default React.createClass({
saveItem() {
const clusters = this.state.clusters;
const cluster = clusters[this.state.active];

client.saveCluster(cluster)
.then(resp => {
clusters[this.state.active] = resp.data;
Expand Down
13 changes: 7 additions & 6 deletions src/pages/Project/All/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ export default React.createClass({
this.updateProjectList();
},

updateProjectList() {
client.listProjects()
.then(resp => this.setState({ projects: resp.data }))
.catch(err => console.log('Error Project/All', err));
},

onAction(action, selectedItems) {
if (selectedItems) {
this[action](selectedItems);
Expand All @@ -42,6 +36,12 @@ export default React.createClass({
}
},

updateProjectList() {
client.listProjects()
.then(resp => this.setState({ projects: resp.data }))
.catch(err => console.log('Error Project/All', err));
},

addItem() {
const filter = '';
this.context.router.replace({
Expand All @@ -52,6 +52,7 @@ export default React.createClass({
},

deleteItems(items) {
/* eslint-disable no-alert */
if (!confirm(`Are you sure you want to delete ${items.length === 1 ? 'this' : 'these'} ${items.length} project${items.length === 1 ? '' : 's'}?`)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Project/Edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ export default React.createClass({
}
},

onAction(action, data, attachement) {
this[action](data, attachement);
},

updateState(id = this.props.params.id) {
client.getProject(id)
.then(resp => this.setState({ project: resp.data }))
.catch(err => console.log('Error: Project/Edit-get', err));
},

onAction(action, data, attachement) {
this[action](data, attachement);
},

editProject(data, attachement) {
const project = merge(this.state.project, data);
client.saveProject(project)
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Project/New/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ export default React.createClass({
};
},

onAction(action, data, attachements) {
this[action](data, attachements);
},

updateForm(e) {
var key = e.target.dataset.name,
value = e.target.value;

this.setState({ [key]: value });
},

onAction(action, data, attachements) {
this[action](data, attachements);
},

newProject(data, attachements) {
const { name, description } = data,
type = this.state.type,
Expand Down
19 changes: 10 additions & 9 deletions src/pages/Project/View/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export default React.createClass({
}
},

onAction(action, selectedItems) {
if (selectedItems) {
this[action](selectedItems);
} else {
this[action]();
}
},

updateState(id = this.props.params.id) {
client.getProject(id)
.then(resp => this.setState({ project: resp.data }))
Expand All @@ -52,19 +60,12 @@ export default React.createClass({
});
},

onAction(action, selectedItems) {
if (selectedItems) {
this[action](selectedItems);
} else {
this[action]();
}
},

addItem() {
this.context.router.replace(`/New/Simulation/${this.props.params.id}`);
},

deleteItems(items) {
/* eslint-disable no-alert */
if (!confirm(`Are you sure you want to delete ${items.length === 1 ? 'this' : 'these'} ${items.length} simulation${items.length === 1 ? '' : 's'}?`)) {
return;
}
Expand All @@ -81,7 +82,7 @@ export default React.createClass({
return (
<TableListing
breadcrumb={{
paths: ['/', `/View/Project/${this.props.params.id}` ],
paths: ['/', `/View/Project/${this.props.params.id}`],
icons: [
breadCrumbStyle.breadCrumbRootIcon,
breadCrumbStyle.breadCrumbProjectIcon,
Expand Down
8 changes: 4 additions & 4 deletions src/pages/Simulation/Edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default React.createClass({
}
},

onAction(action, data, attachement) {
this[action](data, attachement);
},

updateState(id = this.props.params.id) {
client.getSimulation(id)
.then(resp => {
Expand All @@ -54,10 +58,6 @@ export default React.createClass({
});
},

onAction(action, data, attachement) {
this[action](data, attachement);
},

saveSimulation(data) {
const simulation = merge(this.state.simulation, data);

Expand Down
8 changes: 4 additions & 4 deletions src/pages/Simulation/New/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default React.createClass({
}
},

onAction(action, data, attachements) {
this[action](data, attachements);
},

updateProject(id = this.props.params.projectId) {
client.getProject(id)
.then(resp => this.setState({ project: resp.data, error: false }))
Expand All @@ -44,10 +48,6 @@ export default React.createClass({
});
},

onAction(action, data, attachements) {
this[action](data, attachements);
},

newSimulation(data, attachements) {
const { name, description } = data,
projectId = this.props.params.projectId,
Expand Down
1 change: 0 additions & 1 deletion src/panels/FormPanel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function getValue(obj, path, type = 'text') {
return !!result;
}
if (type === 'profile') {
console.log('return profile', result);
return result || [];
}
if (type === 'enum') {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/IconActionList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default React.createClass({
key={action.name}
data-action={action.name}
onClick={this.onAction}
className={ [ style.actionButton, action.icon ].join(' ') }
className={ [style.actionButton, action.icon].join(' ') }
></i>
)}
</div>);
Expand Down
Loading

0 comments on commit 5303502

Please sign in to comment.