Skip to content

Conversation

@flyrain
Copy link
Contributor

@flyrain flyrain commented Jan 19, 2017

No description provided.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we drop this line altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check be in setPolicy or the FSQueue constructor instead?

For instance, FSLeafQueue#setPolicy already checks if the level is appropriate. This brings up another point - do we need this check of parent-child policies AND the depth? Should we get rid of depth either in this JIRA or a follow-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, my original thought is to do that in another JIRA. The depth and parent-child policy are not the same. It mighty a good idea to combine them since the logic of depth checking only prevent fifo policy to be non-leaf queue. The current implementation seems a bit heavy. I can do it in this JIRA.

Copy link
Contributor

Choose a reason for hiding this comment

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

Initialize should likely go to setPolicy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My first thought of this one is similar to the depth checking, planned to refactor it in next JIRA. Another question in my mind is - do we need to initialize policy every time setting the policy?

Copy link
Contributor

Choose a reason for hiding this comment

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

setPolicy should likely be called in the constructor.

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes sense for this method to be boolean. I am not sure we should be throwing an exception here. The caller can decide that based on the return value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on my earlier comment, this should be return ! (childPolicy instanceof DominantResourceFairnessPolicy

Copy link
Contributor

Choose a reason for hiding this comment

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

return false

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be verifyAndSetPolicyFromConf, and part of FSQueue instead of FSParentQueue.

In that case, we will not need a separate call to setPolicy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea!

…olicy if its children have the "drf" policy.
@flyrain
Copy link
Contributor Author

flyrain commented Jan 30, 2017

Thanks Karthik for the review, a new patch posted for your comments.

Copy link
Contributor

@kambatla kambatla left a comment

Choose a reason for hiding this comment

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

Nice work!

Since the subsequent changes are squashed into one commit, I ended up doing the review from scratch. Most comments are minor.

import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceType;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AllocationConfigurationException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import.

Resource queueUsage, Resource maxAvailable);

/**
* Check whether the policy of a child queue are allowed.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/are/is

*
* @param childPolicy the policy of child queue
*/
public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Like that we are adding a non-abstract method.

return SchedulingPolicy.DEPTH_ANY;
public boolean isChildPolicyAllowed(SchedulingPolicy childPolicy) {
if (childPolicy instanceof DominantResourceFairnessPolicy) {
LOG.info("Queue policies can't be " + DominantResourceFairnessPolicy.NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

s/policies/policy

if (childPolicy instanceof DominantResourceFairnessPolicy) {
LOG.info("Queue policies can't be " + DominantResourceFairnessPolicy.NAME
+ " if the parent policy is " + getName() + ". Please choose "
+ "other polices for child queues instead.");
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, we should either (1) not say anything about other policies or (2) list the policies that are allowed.

/**
* Initialize a queue by setting its queue-specific properties and its
* metrics.
* metrics. This function don't set the policy for queues since there is
Copy link
Contributor

Choose a reason for hiding this comment

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

s/function/method - there is one other instance of this in the javadoc

s/don't/does not

Instead of saying there is different logic, can we call out what method does that for easier code navigability? And, it might be worth mentioning why that logic is separated, either here or at the other method.

* @return true if no policy violation and successfully set polices
* for queues; false otherwise
*/
public boolean verifyAndSetPolicyFromConf(AllocationConfiguration queueConf) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worthwhile to point out the intended caller for this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

}

@Test
public void testSchedulingPolicyViolation() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

TestFairScheduler is awfully long. Can we please add these methods elsewhere? TestSchedulingPolicy and TestQueueManager are potential candidates.

*
* @throws AllocationConfigurationException
*/
@Test(timeout = 1000)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are all the cases in this test covered by other tests added here? If not, can we keep the test, maybe rename it, and capture the cases that are not covered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add a new test case to check if fifo policy is only for leaf queues.

…olicy if its children have the "drf" policy.
Copy link
Contributor

@kambatla kambatla left a comment

Choose a reason for hiding this comment

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

Let us fix the checkstyle issues along with the one nit.

* different logic to do that.
* This function is invoked when a new queue is created or reloading the
* allocation configuration.
* metrics. This method is invoked when a new queue is created or reloading
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor language comment. Let us use one of the following two:

  • when creating a new queue or reloading the allocation file.
  • when a new is created or the allocation file is reloaded.

…olicy if its children have the "drf" policy.
@flyrain
Copy link
Contributor Author

flyrain commented Apr 4, 2017

Committed.

@flyrain flyrain closed this Apr 4, 2017
shanthoosh pushed a commit to shanthoosh/hadoop that referenced this pull request Oct 15, 2019
…arrierForVersionUpgrade

The code changed significantly. I've rerun the test multiple times both with gradle and intelij. It passed every time. I suggest we enable it back.

Author: Boris Shkolnik <boryas@apache.org>

Reviewers: Xinyu Liu <xinyu@apache.org>

Closes apache#181 from sborya/testZkBarrierForVersionUpgrade
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.

2 participants