-
Notifications
You must be signed in to change notification settings - Fork 594
upgrade yarn scheduler driver memory to ByteAmount #1728
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
package com.twitter.heron.scheduler.yarn; | ||
|
||
import com.twitter.heron.common.basics.ByteAmount; | ||
import com.twitter.heron.spi.common.Config; | ||
import com.twitter.heron.spi.common.Context; | ||
|
||
|
@@ -27,8 +28,8 @@ public static String heronYarnQueue(Config cfg) { | |
YarnKey.HERON_SCHEDULER_YARN_QUEUE.getDefaultString()); | ||
} | ||
|
||
public static int heronDriverMemoryMb(Config cfg) { | ||
return cfg.getIntegerValue(YarnKey.YARN_SCHEDULER_DRIVER_MEMORY_MB.value(), | ||
YarnKey.YARN_SCHEDULER_DRIVER_MEMORY_MB.getDefaultInt()); | ||
public static ByteAmount heronDriverMemoryMb(Config cfg) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree |
||
return cfg.getByteAmountValueMB(YarnKey.YARN_SCHEDULER_DRIVER_MEMORY_MB.value(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do |
||
(ByteAmount) YarnKey.YARN_SCHEDULER_DRIVER_MEMORY_MB.getDefault()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
import org.apache.reef.tang.annotations.Unit; | ||
import org.apache.reef.tang.exceptions.InjectionException; | ||
|
||
import com.twitter.heron.common.basics.ByteAmount; | ||
import com.twitter.heron.scheduler.yarn.HeronMasterDriver.ContainerAllocationHandler; | ||
import com.twitter.heron.scheduler.yarn.HeronMasterDriver.FailedContainerHandler; | ||
import com.twitter.heron.scheduler.yarn.HeronMasterDriver.HeronSchedulerLauncher; | ||
|
@@ -63,7 +64,7 @@ public class YarnLauncher implements ILauncher { | |
private String role; | ||
private String env; | ||
private String queue; | ||
private int driverMemory; | ||
private ByteAmount driverMemory; | ||
private ArrayList<String> libJars = new ArrayList<>(); | ||
|
||
@Override | ||
|
@@ -161,7 +162,7 @@ Configuration getHMDriverConf() { | |
.set(HeronDriverConfiguration.HTTP_PORT, 0) | ||
.set(HeronDriverConfiguration.VERBOSE, false) | ||
.set(YarnDriverConfiguration.QUEUE, queue) | ||
.set(DriverConfiguration.DRIVER_MEMORY, driverMemory) | ||
.set(DriverConfiguration.DRIVER_MEMORY, driverMemory.asMegabytes()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused here. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be honest, it make me confused too. I didn't notice that... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @objmagic - cast it to int There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you can just cast here...? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mycFelix I now think I am not the right person to review this PR. You can think about Bill's review and wait for @ashvina's comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @objmagic - Sure~ |
||
.build(); | ||
} | ||
|
||
|
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.
Instead of adding a utility method for each unit, I think adding a unit to the existing method would be better. For e.g.
getByteAmount(Object o)
will become getByteAmount(Object o, ByteAmountUnit unit). This is same as the usage pattern ofjava.util.concurrent.Delayed.getDelay(TimeUnit unit)
. What do you think?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.
Good point~
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.
@billonahill - It seems we don't have
ByteAmountUnit
class currently. Do you think it is a good idea if we add a new class inc.t.h.common.basics
in this PR?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.
@mycFelix Bill is on vacation so he may not have spare time to reply you. We can definitely add
ByteAmountUnit
(and as a enum class to keep things simple). Another approach is to make2048
into2048 * 1024
. We sacrifice some clarity here but can avoid extending current APIs. Thoughts? @ashvinaThere 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.
@mycFelix actually, now I think @ashvina's suggestion is better. It would be nice to add a enum class
ByteAmountUnit
in the same style ofSystemConfigKey
to exposeMB
andGB
in a typed manner.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.
@objmagic - Understood. Thank you for your suggestion.