Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 doing this for each invocation - find out which method is exposed and set some flag to return appropriate value based on that via reflection.
I will defer to Tom on whether there is a better way to do this.
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.
getAMRespImpl() macro is only called once when compiling allocateContainers() method at compile-time, so invocations of allocateContainers() will not do reflection at run-time.
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.
why would we want to hardcode this at compile time ?
better would be to reflect and find it at runtime - so that same code runs in both versions.
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.
run time reflection also need hard code method name that does't exist in beta api, and have to pay the run time cost of reflect calls. even if using runtime reflection, IMO, we would rarely deploy spark-assembly-xxx-hadoop2.0.0-cdh4.6.0.jar on a cluster running hadoop cdh4.2.0, and vise versa.
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.
On Sat, Mar 15, 2014 at 9:55 PM, gzm55 notifications@github.com wrote:
Cache the resolved method - it is fairly cheap once that happens.
There is a reason java does not support macro's.
That is indeed a fair 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.
I tried to use runtime refleciton, and found some difficults. because amResp will have different type, I've to give it a duck type like
AnyRef {
def getAllocatedContainers ...
def getAvailableResources ...
def getCompletedContainersStatuses ...
}
or have to cache four reflection methods (the upper three plus getAMResponse()). in the future, each time we introduce a method of AMResponse/AllocateResponse, we'll have to make additional cache for it.
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.
I would look at this as a very uncommon and temporary situation.
We would need to continue supporting the old api for only a little while
longer - after which we can remove the reflection stuff; and ideally, yarn
should converge on a stable api soon enough.
So until then, unfortunately, we have instability in our impl.
On Sat, Mar 15, 2014 at 10:32 PM, gzm55 notifications@github.com wrote: