[
https://issues.apache.org/jira/browse/TWILL-241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16116857#comment-16116857
]
ASF GitHub Bot commented on TWILL-241:
--------------------------------------
Github user anew commented on a diff in the pull request:
https://github.com/apache/twill/pull/59#discussion_r131708495
--- Diff:
twill-core/src/main/java/org/apache/twill/internal/TwillRuntimeSpecification.java
---
@@ -171,9 +168,27 @@ public String getKafkaZKConnect() {
/**
* Returns the minimum heap ratio ({@link
Configs.Keys#HEAP_RESERVED_MIN_RATIO}) based on the given configuration.
*/
- private double getMinHeapRatio(Map<String, String> config) {
- return config.containsKey(Configs.Keys.HEAP_RESERVED_MIN_RATIO) ?
- Double.parseDouble(config.get(Configs.Keys.HEAP_RESERVED_MIN_RATIO))
:
- Configs.Defaults.HEAP_RESERVED_MIN_RATIO;
+ private double getMinHeapRatio(@Nullable Map<String, String> config,
double defaultValue) {
+ if (config == null) {
--- End diff --
I think this would be easier to read, and it would give better errors, as
follows:
```
if (config == null || !config.containsKey(...)) {
return defaultValue;
}
try {
double ratio = Double.parseDouble(config.get(...));
} catch (NumberFormatException) {
// either warn or throw a more informative exn (including runnable name
and the bad value)
}
if (ratio <= 0d) {
// either warn or throw a more informative exn (including runnable name
and the bad value)
}
return ratio;
```
> Allow specifying reserved off-heap memory and extra JVM options per runnable
> ----------------------------------------------------------------------------
>
> Key: TWILL-241
> URL: https://issues.apache.org/jira/browse/TWILL-241
> Project: Apache Twill
> Issue Type: Improvement
> Components: api, yarn
> Affects Versions: 0.11.0
> Reporter: Andreas Neumann
> Assignee: Terence Yim
> Fix For: 0.12.0
>
>
> Sometimes, a particular runnable needs a lot more off-heap memory than
> others. It would therefore be useful to specify the amount of reserved
> non-heap memory per runnable.
> Similarly, for example, for debugging purposes, it may be necessary to add a
> JVM option for one of the runnables without affecting the other runnables of
> the same application.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)