forked from apache/hadoop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YARN-4138. Roll back container resource allocation after resource inc…
…rease token expires. Contributed by Meng Ding
- Loading branch information
Showing
16 changed files
with
804 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...a/org/apache/hadoop/yarn/server/resourcemanager/rmcontainer/AllocationExpirationInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hadoop.yarn.server.resourcemanager.rmcontainer; | ||
|
||
|
||
import org.apache.hadoop.yarn.api.records.ContainerId; | ||
|
||
public class AllocationExpirationInfo implements | ||
Comparable<AllocationExpirationInfo> { | ||
|
||
private final ContainerId containerId; | ||
private final boolean increase; | ||
|
||
public AllocationExpirationInfo(ContainerId containerId) { | ||
this(containerId, false); | ||
} | ||
|
||
public AllocationExpirationInfo( | ||
ContainerId containerId, boolean increase) { | ||
this.containerId = containerId; | ||
this.increase = increase; | ||
} | ||
|
||
public ContainerId getContainerId() { | ||
return this.containerId; | ||
} | ||
|
||
public boolean isIncrease() { | ||
return this.increase; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return (getContainerId().hashCode() << 16); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (!(other instanceof AllocationExpirationInfo)) { | ||
return false; | ||
} | ||
return compareTo((AllocationExpirationInfo)other) == 0; | ||
} | ||
|
||
@Override | ||
public int compareTo(AllocationExpirationInfo other) { | ||
if (other == null) { | ||
return -1; | ||
} | ||
// Only need to compare containerId. | ||
return getContainerId().compareTo(other.getContainerId()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "<container=" + getContainerId() + ", increase=" | ||
+ isIncrease() + ">"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.../hadoop/yarn/server/resourcemanager/rmcontainer/RMContainerNMDoneChangeResourceEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hadoop.yarn.server.resourcemanager.rmcontainer; | ||
|
||
import org.apache.hadoop.yarn.api.records.ContainerId; | ||
import org.apache.hadoop.yarn.api.records.Resource; | ||
|
||
public class RMContainerNMDoneChangeResourceEvent extends RMContainerEvent { | ||
|
||
private final Resource nmContainerResource; | ||
|
||
public RMContainerNMDoneChangeResourceEvent( | ||
ContainerId containerId, Resource nmContainerResource) { | ||
super(containerId, RMContainerEventType.NM_DONE_CHANGE_RESOURCE); | ||
this.nmContainerResource = nmContainerResource; | ||
} | ||
|
||
public Resource getNMContainerResource() { | ||
return nmContainerResource; | ||
} | ||
} |
Oops, something went wrong.