diff --git a/aws-provisioner/workertypeview.jsx b/aws-provisioner/workertypeview.jsx index ba5a6e5..bcd1d6d 100644 --- a/aws-provisioner/workertypeview.jsx +++ b/aws-provisioner/workertypeview.jsx @@ -12,7 +12,6 @@ var WorkerTypeResources = React.createClass({ workerType: React.PropTypes.object.isRequired, awsState: React.PropTypes.shape({ instances: React.PropTypes.arrayOf(React.PropTypes.object), - internalTrackedRequests: React.PropTypes.arrayOf(React.PropTypes.object), requests: React.PropTypes.arrayOf(React.PropTypes.object), }).isRequired }, @@ -21,9 +20,8 @@ var WorkerTypeResources = React.createClass({ return (

Running Instances

- We have  - {this.props.awsState.instances.length} -  instances running with total capacity of {this.runningCapacity()}. + We have a total running instance capacity of {this.runningCapacity()}. + These are instance that the provisioner counts as doing work. @@ -37,14 +35,14 @@ var WorkerTypeResources = React.createClass({ { - this.props.awsState.instances.map(this.renderInstanceRow) + this.props.awsState.instances.filter(x => x.state === 'running').map(this.renderInstanceRow) }

Pending Instances

- We have {this.props.awsState.internalTrackedRequests.length} -  instances starting up with total capacity of  - {this.pendingCapacity()}. + We have a total pending instance capacity of {this.pendingCapacity()}. + These are filled spot requests which are not yet doing work. These are + usually instances which are booting up. @@ -58,14 +56,14 @@ var WorkerTypeResources = React.createClass({ { - this.props.awsState.internalTrackedRequests.map(this.renderInstanceRow) + this.props.awsState.instances.filter(x => x.state === 'pending').map(this.renderInstanceRow) }

Spot Requests

- We have spot requests for  - {this.props.awsState.requests.length} -  instances with total capacity of {this.spotReqCapacity()}. + We have unfilled spot requests for a capacity of {this.spotReqCapacity()}. + Amazon is yet to decided on the bid, or they have not told us the + outcome yet. @@ -195,7 +193,7 @@ var WorkerTypeResources = React.createClass({ }, runningCapacity() { - return _.sumBy(this.props.awsState.instances.map(instance => { + return _.sumBy(this.props.awsState.instances.filter(x => x.state === 'running').map(instance => { return _.find(this.props.workerType.instanceTypes, { instanceType: instance.type }); @@ -203,7 +201,7 @@ var WorkerTypeResources = React.createClass({ }, pendingCapacity() { - return _.sumBy(this.props.awsState.internalTrackedRequests.map(instance => { + return _.sumBy(this.props.awsState.instances.filter(x => x.state === 'pending').map(instance => { return _.find(this.props.workerType.instanceTypes, { instanceType: instance.type }); @@ -224,7 +222,6 @@ var WorkerTypeStatus = React.createClass({ workerType: React.PropTypes.object.isRequired, awsState: React.PropTypes.shape({ instances: React.PropTypes.arrayOf(React.PropTypes.object), - internalTrackedRequests: React.PropTypes.arrayOf(React.PropTypes.object), requests: React.PropTypes.arrayOf(React.PropTypes.object), }).isRequired }, @@ -233,7 +230,6 @@ var WorkerTypeStatus = React.createClass({ // Find availability zones var availabilityZones = _.union( this.props.awsState.instances.map(_.property('zone')), - this.props.awsState.internalTrackedRequests.map(_.property('zone')), this.props.awsState.requests.map(_.property('zone')) ); return ( @@ -266,10 +262,12 @@ var WorkerTypeStatus = React.createClass({ // Find number of running, pending and spotRequests var running = this.props.awsState.instances.filter(inst => { return inst.type === instTypeDef.instanceType && + inst.state === 'running' && inst.zone === availabilityZone; }).length; - var pending = this.props.awsState.internalTrackedRequests.filter(inst => { + var pending = this.props.awsState.instances.filter(inst => { return inst.type === instTypeDef.instanceType && + inst.state === 'pending' && inst.zone === availabilityZone; }).length; var spotReq = this.props.awsState.requests.filter(spotReq => {