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<URL> 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 [email protected] or file a JIRA ticket
with INFRA.
---