denysyankiv commented on a change in pull request #1393:
URL: https://github.com/apache/incubator-datalab/pull/1393#discussion_r790525130
##########
File path:
services/self-service/src/main/java/com/epam/datalab/backendapi/service/impl/BillingServiceImpl.java
##########
@@ -340,6 +341,21 @@ private void appendStatuses(BillingReportLine br) {
}
}
+ private void appendShapes(BillingReportLine br) {
+ BillingResourceType resourceType = br.getResourceType();
+ if (BillingResourceType.COMPUTATIONAL == resourceType) {
+ String shape = "Master: 1 x %s Slave: %s x %s";
+ exploratoryService.getUserInstance(br.getUser(), br.getProject(),
br.getExploratoryName(), true)
+ .flatMap(ui -> ui.getResources()
+ .stream()
+ .filter(cr ->
cr.getComputationalName().equals(br.getResourceName()))
+ .findAny())
+ .ifPresent(cr -> br.setShape(
+ String.format(shape, cr.getMasterNodeShape(),
cr.getTotalInstanceCount() - 1, cr.getSlaveNodeShape())
Review comment:
Total instance count contains sum of number of slave nodes and master
nodes. So to get number of slave nodes we need to subtract number of master
nodes. Added java doc and variable for readability. Thanks for suggestion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]