Skip to content

Commit

Permalink
feat(GPU): add gpu to debug screen
Browse files Browse the repository at this point in the history
Needed to add some default values, because GPU is not yet pr, because GPU is not
yet provided

Closes DCOS-21935
  • Loading branch information
Daniel Schmidt committed Apr 23, 2018
1 parent a21d138 commit b6f23a9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
15 changes: 14 additions & 1 deletion plugins/services/src/js/components/DeclinedOffersTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DeclinedOffersTable extends React.Component {
"text-danger": isResourceUnmatched
});

let requestedResource = summary[prop].requested;
let requestedResource = (summary[prop] || { requested: 0 }).requested;
let receivedResource = row.offered[prop];

let requestedResourceSuffix = "";
Expand Down Expand Up @@ -290,6 +290,19 @@ class DeclinedOffersTable extends React.Component {
)
)
},
{
heading: this.getColumnHeadingFn("GPU"),
prop: "gpus",
className: this.getColumnClassNameFn("text-align-center"),
render: this.getMatchedOfferRenderFn(
DeclinedOffersReasons.INSUFFICIENT_GPU
),
sortable: true,
sortFunction: TableUtil.getSortFunction(
"timestamp",
this.getMatchedResourcesSortFn(DeclinedOffersReasons.INSUFFICIENT_GPU)
)
},
{
heading: this.getColumnHeadingFn("Port", "PRT"),
prop: "ports",
Expand Down
17 changes: 14 additions & 3 deletions plugins/services/src/js/components/RecentOffersSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const displayedResourceValues = {
const MAX_BAR_HEIGHT = 200;

function getGraphBar(resource, data, index) {
const resourceOfferSummary = data[resource];
const resourceOfferSummary = data[resource] || { offers: 0, matched: 0 };
const matchedOffers = resourceOfferSummary.matched;
const offeredCount = resourceOfferSummary.offers;
let percentageMatched = null;
Expand Down Expand Up @@ -99,7 +99,10 @@ function getGraphSpacer({ key, showIcon = true }) {
}

function getResourceTooltipContent(resource, data) {
let { matched, offers, requested: requestedValue } = data[resource];
let { matched, offers, requested: requestedValue } = data[resource] || {
offers: 0,
matched: 0
};
let docsURI = null;
let explanatoryText = null;

Expand Down Expand Up @@ -158,7 +161,15 @@ function getResourceTooltipContent(resource, data) {
}

function RecentOffersSummary({ data }) {
const funnelItems = ["roles", "constraints", "cpus", "mem", "disk", "ports"];
const funnelItems = [
"roles",
"constraints",
"cpus",
"mem",
"disk",
"gpus",
"ports"
];
const funnelGraphItems = funnelItems.reduce((accumulator, item, index) => {
accumulator.push(getGraphBar(item, data, index));

Expand Down
1 change: 1 addition & 0 deletions plugins/services/src/js/constants/DeclinedOffersReasons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
INSUFFICIENT_MEM: "InsufficientMemory",
INSUFFICIENT_CPU: "InsufficientCpus",
INSUFFICIENT_DISK: "InsufficientDisk",
INSUFFICIENT_GPU: "InsufficientGpus",
INSUFFICIENT_PORTS: "InsufficientPorts",
UNFULFILLED_CONSTRAINT: "UnfulfilledConstraint",
UNFULFILLED_ROLE: "UnfulfilledRole"
Expand Down

0 comments on commit b6f23a9

Please sign in to comment.