[GitHub] twill pull request #53: (TWILL-230) Get resource report based on the caller ...

2017-04-03 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/twill/pull/53


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] twill pull request #53: (TWILL-230) Get resource report based on the caller ...

2017-04-03 Thread chtyim
Github user chtyim commented on a diff in the pull request:

https://github.com/apache/twill/pull/53#discussion_r109553180
  
--- Diff: 
twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillController.java ---
@@ -322,7 +314,46 @@ private boolean hasRun(YarnApplicationState state) {
 
   @Override
   public ResourceReport getResourceReport() {
-// in case the user calls this before starting, return null
+// Only has resource report if the app is running.
+if (state() != State.RUNNING) {
+  return null;
+}
+ResourceReportClient resourcesClient = getResourcesClient();
 return (resourcesClient == null) ? null : resourcesClient.get();
   }
+
+  /**
+   * Returns the {@link ResourceReportClient} for fetching resource report 
from the AM.
+   * It first consults the RM for the tracking URL and get the resource 
report from there.
+   */
+  @Nullable
+  private ResourceReportClient getResourcesClient() {
+YarnApplicationReport report = processController.getReport();
+List urls = new ArrayList<>(2);
--- End diff --

Because we store the tracking URL and the original tracking URL.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] twill pull request #53: (TWILL-230) Get resource report based on the caller ...

2017-04-03 Thread yaojiefeng
Github user yaojiefeng commented on a diff in the pull request:

https://github.com/apache/twill/pull/53#discussion_r109552373
  
--- Diff: 
twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillController.java ---
@@ -322,7 +314,46 @@ private boolean hasRun(YarnApplicationState state) {
 
   @Override
   public ResourceReport getResourceReport() {
-// in case the user calls this before starting, return null
+// Only has resource report if the app is running.
+if (state() != State.RUNNING) {
+  return null;
+}
+ResourceReportClient resourcesClient = getResourcesClient();
 return (resourcesClient == null) ? null : resourcesClient.get();
   }
+
+  /**
+   * Returns the {@link ResourceReportClient} for fetching resource report 
from the AM.
+   * It first consults the RM for the tracking URL and get the resource 
report from there.
+   */
+  @Nullable
+  private ResourceReportClient getResourcesClient() {
+YarnApplicationReport report = processController.getReport();
+List urls = new ArrayList<>(2);
--- End diff --

Why will this url list has initial capacity of 2?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] twill pull request #53: (TWILL-230) Get resource report based on the caller ...

2017-04-03 Thread chtyim
GitHub user chtyim opened a pull request:

https://github.com/apache/twill/pull/53

(TWILL-230) Get resource report based on the caller user

- Also by default get the resource report from the tracking url, then fall 
back to the original tracking url.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/chtyim/twill feature/TWILL-230

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/twill/pull/53.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #53


commit 239619d8a1ccb08dae3c3262f380b87759a574f6
Author: Terence Yim 
Date:   2017-04-03T23:49:52Z

(TWILL-230) Get resource report based on the caller user

- Also by default get the resource report from the tracking url, then fall 
back to the original tracking url.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---