Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-3456] YarnAllocator on alpha can lose container requests to RM #2373

Closed
wants to merge 1 commit into from

Conversation

tgravescs
Copy link
Contributor

No description provided.

@tgravescs
Copy link
Contributor Author

cc @vanzin

@SparkQA
Copy link

SparkQA commented Sep 12, 2014

QA tests have started for PR 2373 at commit 77e9532.

  • This patch merges cleanly.

@vanzin
Copy link
Contributor

vanzin commented Sep 12, 2014

LGTM. Guess I assumed alpha would work like stable in this area...

@tgravescs
Copy link
Contributor Author

yeah no big deal, I should have seen this in testing it originally.
unfortunately the alpha doesn't use the AMRMClient api which handles adding them.

Thanks for the review. I'll wait for jenkins on this.

@SparkQA
Copy link

SparkQA commented Sep 12, 2014

QA tests have finished for PR 2373 at commit 77e9532.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@@ -121,7 +124,7 @@ private[yarn] abstract class YarnAllocator(
logDebug("Empty allocation request ...")
}

val allocateResponse = allocateContainers(missing)
val allocateResponse = allocateContainers(missing, executorsPending)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we expose the number of requests pending to the subclass, we don't need to make this take an extra parameter. E.g.

protected def numContainersPending = numPendingAllocate.get()

Then the alpha YarnAllocationHandler#allocateContainers can add this to count instead of the new parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but it seems kind of weird to have it pass count but then grab a global for pending. It would also be easier to unit test taking it as paramater (if we had unit tests for this)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought it would simplify the method signatures. Right now the stable code takes in a parameter that it doesn't use, and in the alpha code all we do with those two parameters is add them together anyway. The number of pending container requests is a property of the allocator, so I think it makes sense if all methods in the class have access to this. (Not a huge deal)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the concern over the interfaces, but in the end hopefully this doesn't matter as hopefully we will be removing alpha support in another release. Also its an internal private interface.

To me this is safer to have one unused variable vs exposing a private variable. For instance, you will notice that if I removed all changes to YarnAllocator (except for making numPendingAllocate protected) and just grabbed it from the alpha/YarnAllocateHandler, it would be wrong - it would ask for 2x the number because we increment the numberPendig before calling allocateContainers. To me exposing that variable could more easily lead to issues like that and perhaps others accessing it and leading to more complicated usage numPending in the future. It also seems more brittle if someone comes in here and refactors things again.

I could change YarnAllocator to rearrange it to call allocateContainers before incrementing numPending for now and put comment there saying the order matters.

I would prefer to leave it, but If you would really like me to I will.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe to expose the variable as long as it does what its name suggests. We actually already do this elsewhere in the same class for similar variables (e.g. getNumExecutorRunning or getNumExecutorFailed). In our case, we can't make just those changes because we increment numPendingAllocate before we allocateContainers, but we can easily work around that as you mentioned. These allocation requests aren't technically pending until we've submitted them, so I think it's actually more correct to increment numPendingAllocate afterwards.

Anyway, just a minor suggestion since this is an internal API. It's fine to leave it as is if you prefer.

@asfgit asfgit closed this in 25311c2 Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants