forked from eBay/myriad
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Myriad's hadoop dependency from version 2.5 to 2.7.
The following problems surfaced during this change: 1. The API that Myriad was using to update NM's capacity is removed in 2.7. It's replaced with a NODE_RESOURCE_UPDATE event (YARN-1506). 2. RM rejects app submissions if the size of the AM container requested is greater than the capacity of the largest NM (YARN-3079, YARN-2604). Since FGS sets the NM's capacity to zero during NM's registration with RM, the app submission fails.
- Loading branch information
Showing
15 changed files
with
265 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
myriad-scheduler/src/main/java/com/ebay/myriad/scheduler/OfferUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.ebay.myriad.scheduler; | ||
|
||
import java.util.Collection; | ||
import org.apache.hadoop.yarn.api.records.Resource; | ||
import org.apache.mesos.Protos; | ||
import org.apache.mesos.Protos.Offer; | ||
|
||
/** | ||
* Utility class that provides useful methods that deal with Mesos offers. | ||
*/ | ||
public class OfferUtils { | ||
|
||
/** | ||
* Transforms a collection of mesos offers into {@link Resource}. | ||
* | ||
* @param offers collection of mesos offers | ||
* @return a single resource object equivalent to the cumulative sum of mesos offers | ||
*/ | ||
public static Resource getYarnResourcesFromMesosOffers(Collection<Offer> offers) { | ||
double cpus = 0.0; | ||
double mem = 0.0; | ||
|
||
for (Protos.Offer offer : offers) { | ||
for (Protos.Resource resource : offer.getResourcesList()) { | ||
if (resource.getName().equalsIgnoreCase("cpus")) { | ||
cpus += resource.getScalar().getValue(); | ||
} else if (resource.getName().equalsIgnoreCase("mem")) { | ||
mem += resource.getScalar().getValue(); | ||
} | ||
} | ||
} | ||
return Resource.newInstance((int) mem, (int) cpus); | ||
} | ||
|
||
} |
Oops, something went wrong.
1 comment
on commit 2b76199
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed to mention in the commit message:
Problem 1 mentioned in the commit message is fixed in this change. i.e. 1. Myriad's code is changed to use the new NODE_RESOURCE_UPDATE_EVENT to update NM's capacity.
We need to externalize those versions, as different people can have different dependencies. Not for this PR though