diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTarget.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTarget.java new file mode 100644 index 0000000..b1f550d --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTarget.java @@ -0,0 +1,32 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.yarn.util.guts.AffinityTargetsBuilder; + +public abstract class AffinityTarget { + public abstract AffinityTargetType getTargetType(); + + public abstract String getTarget(); + + public static AffinityTargetsBuilder newBuilder() { + // TODO + return null; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTargetType.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTargetType.java new file mode 100644 index 0000000..eb7a7e0 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AffinityTargetType.java @@ -0,0 +1,26 @@ +/** + * 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.api.protocolrecords; + +public enum AffinityTargetType { + APPLICATION, + ALLOCATION_TAG, + NODE, + RACK +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java index e24ebdf..98df890 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java @@ -133,7 +133,7 @@ public static AllocateRequest newInstance(int responseID, float appProgress, * @see ResourceRequest */ @Public - @Stable + @Deprecated public abstract List getAskList(); /** @@ -145,7 +145,7 @@ public static AllocateRequest newInstance(int responseID, float appProgress, * @see ResourceRequest */ @Public - @Stable + @Deprecated public abstract void setAskList(List resourceRequests); /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/DelayToNextCriteria.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/DelayToNextCriteria.java new file mode 100644 index 0000000..8f059b2 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/DelayToNextCriteria.java @@ -0,0 +1,25 @@ +/** + * 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.api.protocolrecords; + +public abstract class DelayToNextCriteria { + public abstract long getMaxDelayInMs(); + + public abstract long getMaxMissedOpportunities(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GutsResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GutsResourceRequest.java new file mode 100644 index 0000000..ff39e87 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GutsResourceRequest.java @@ -0,0 +1,42 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.yarn.api.records.Priority; +import org.apache.hadoop.yarn.api.records.Resource; +import org.apache.hadoop.yarn.util.guts.GutsResourceRequestBuilder; + +import java.util.Set; + +public abstract class GutsResourceRequest { + public abstract Priority getPriority(); + + public abstract Resource getAllocationSize(); + + public abstract int getMaximumAllocation(); + + public abstract Set getAllocationTags(); + + public abstract PlacementStrategy getPlacementStrategy(); + + public static GutsResourceRequestBuilder newBuilder() { + // TODO; + return null; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/OrderedOrPlacementStrategy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/OrderedOrPlacementStrategy.java new file mode 100644 index 0000000..3b56172 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/OrderedOrPlacementStrategy.java @@ -0,0 +1,23 @@ +/** + * 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.api.protocolrecords; + +public abstract class OrderedOrPlacementStrategy extends PlacementStrategy { + public abstract DelayToNextCriteria[] getDelayToNextCriterias(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementSetScope.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementSetScope.java new file mode 100644 index 0000000..1fa3264 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementSetScope.java @@ -0,0 +1,24 @@ +/** + * 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.api.protocolrecords; + +public enum PlacementSetScope { + NODE, + RACK, +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategy.java new file mode 100644 index 0000000..5468009 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategy.java @@ -0,0 +1,39 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.yarn.util.guts.PlacementStrategyBuilder; + +public abstract class PlacementStrategy { + + public abstract PlacementStrategyOperatorType getOperator(); + + public abstract PlacementStrategy[] getStrategies(); + + public abstract PlacementSetScope getScope(); + + public abstract int getMaximumAllocation(); + + public abstract AffinityTarget[] getAffinityTargets(); + + public static PlacementStrategyBuilder newBuilder() { + // TODO; + return null; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategyOperatorType.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategyOperatorType.java new file mode 100644 index 0000000..5f41938 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/PlacementStrategyOperatorType.java @@ -0,0 +1,26 @@ +/** + * 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.api.protocolrecords; + +public enum PlacementStrategyOperatorType { + AND, // DEFAULT + NOT, + OR, + ORDERED_OR +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ResourceRequestCollection.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ResourceRequestCollection.java new file mode 100644 index 0000000..1bb8402 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ResourceRequestCollection.java @@ -0,0 +1,31 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.yarn.util.guts.ResourceRequestCollectionBuilder; + +import java.util.Map; + +public abstract class ResourceRequestCollection { + public abstract Map getRequestMap(); + + public static ResourceRequestCollectionBuilder newBuilder() { + return new ResourceRequestCollectionBuilder(); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/AffinityTargetsBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/AffinityTargetsBuilder.java new file mode 100644 index 0000000..56a6d98 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/AffinityTargetsBuilder.java @@ -0,0 +1,30 @@ +package org.apache.hadoop.yarn.util.guts; + +import org.apache.hadoop.yarn.api.records.ApplicationId; + +public class AffinityTargetsBuilder { + public AffinityTargetsBuilder toApplication(ApplicationId appId) { + // TODO; + return this; + } + + public AffinityTargetsBuilder toAllocationTags(String... tags) { + // TODO; + return this; + } + + public AffinityTargetsBuilder toHosts(String... hosts) { + // TODO; + return this; + } + + public AffinityTargetsBuilder toRacks(String... racks) { + // TODO; + return this; + } + + public AffinityTargetsBuilder toPartition(String partition) { + // TODO; + return this; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/Examples.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/Examples.java new file mode 100644 index 0000000..f446831 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/Examples.java @@ -0,0 +1,112 @@ +package org.apache.hadoop.yarn.util.guts; + +import org.apache.hadoop.yarn.api.protocolrecords.AffinityTarget; +import org.apache.hadoop.yarn.api.protocolrecords.GutsResourceRequest; +import org.apache.hadoop.yarn.api.protocolrecords.PlacementStrategy; +import org.apache.hadoop.yarn.api.protocolrecords.ResourceRequestCollection; +import org.apache.hadoop.yarn.api.records.ApplicationId; +import org.apache.hadoop.yarn.api.records.Resource; + +public class Examples { + /* + * Application want 10 containers, do not run >1 container on each host + */ + public ResourceRequestCollection selfAntiAffinity() { + ApplicationId myApplicationId = null; + + ResourceRequestCollectionBuilder builder = + ResourceRequestCollection.newBuilder(); + builder.addRequest(12345L, GutsResourceRequest.newBuilder().allocationTags( + "regionServer", "service") + .maximumAllocation(10) + .priority(3) + .resource(Resource.newInstance(1024, 1)) + .placementStrategy( + PlacementStrategy.newBuilder().not( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toApplication(myApplicationId))))); + + return builder.build(); + } + + /* + * Affinity to another app. + * + * One MR application want to affintiy to a Hbase application's regionServers + */ + public ResourceRequestCollection affinityToAnotherApp() { + ApplicationId hbaseApplicationId = null; + + ResourceRequestCollectionBuilder builder = + ResourceRequestCollection.newBuilder(); + builder.addRequest(12345L, GutsResourceRequest.newBuilder().allocationTags( + "MR", "batch") + .maximumAllocation(10) + .priority(3) + .resource(Resource.newInstance(1024, 1)) + .placementStrategy( + PlacementStrategy.newBuilder().not( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toApplication(hbaseApplicationId) + .toAllocationTags("region-server"))))); + + return builder.build(); + } + + /* + * Application want to run on rack1 or rack2 only, but don't want to run + * host1/host2 from /rack1, and don't want to run host3/host4 on /rack2 + */ + public ResourceRequestCollection andOrNot() { + ResourceRequestCollectionBuilder builder = + ResourceRequestCollection.newBuilder(); + builder.addRequest(12345L, GutsResourceRequest.newBuilder().allocationTags( + "regionServer", "service") + .maximumAllocation(10) + .priority(3) + .resource(Resource.newInstance(1024, 1)) + .placementStrategy( + PlacementStrategy.newBuilder().or( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder().toRacks("/rack1")) + .not( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toHosts("host1", "host2"))), + + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder().toRacks("/rack2")) + .not( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toHosts("host3", "host4"))))); + + return builder.build(); + } + + /* + * Prefer to run on GPU partition, but also accept CPU partition after try + */ + public ResourceRequestCollection orderedOr() { + ResourceRequestCollectionBuilder builder = + ResourceRequestCollection.newBuilder(); + builder.addRequest(12345L, GutsResourceRequest.newBuilder().allocationTags( + "tensorflow", "service") + .priority(3) + .maximumAllocation() + .resource(Resource.newInstance(1024, 1)) + .placementStrategy( + PlacementStrategy.newBuilder().orderedOr( + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toPartition("GPU_PARTITION")), + PlacementStrategy.newBuilder() + .addAffinityTarget(AffinityTarget.newBuilder() + .toPartition("*"))) + .delayCriteras(/* 5 mins */))); + + return builder.build(); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/GutsResourceRequestBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/GutsResourceRequestBuilder.java new file mode 100644 index 0000000..03632d9 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/GutsResourceRequestBuilder.java @@ -0,0 +1,57 @@ +/** + * 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.util.guts; + +import org.apache.hadoop.yarn.api.protocolrecords.GutsResourceRequest; +import org.apache.hadoop.yarn.api.records.Priority; +import org.apache.hadoop.yarn.api.records.Resource; + +public class GutsResourceRequestBuilder { + + public GutsResourceRequestBuilder priority(Priority priority) { + // TODO; + return this; + } + + public GutsResourceRequestBuilder resource(Resource resource) { + // TODO; + return this; + } + + public GutsResourceRequestBuilder maximumAllocation(int maximumAllocation) { + // TODO; + return this; + } + + public GutsResourceRequestBuilder allocationTags(String... tags) { + // TODO; + return this; + } + + public GutsResourceRequestBuilder placementStrategy( + PlacementStrategyBuilder placementStrategyBuilder) { + // TODO; + return this; + } + + public GutsResourceRequest build() { + // TODO; + return null; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/PlacementStrategyBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/PlacementStrategyBuilder.java new file mode 100644 index 0000000..8427847 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/PlacementStrategyBuilder.java @@ -0,0 +1,49 @@ +package org.apache.hadoop.yarn.util.guts; + +import org.apache.hadoop.yarn.api.protocolrecords.DelayToNextCriteria; +import org.apache.hadoop.yarn.api.protocolrecords.PlacementSetScope; + +public class PlacementStrategyBuilder { + public PlacementStrategyBuilder and(PlacementStrategyBuilder... strategies) { + // TODO + return this; + } + + public PlacementStrategyBuilder or(PlacementStrategyBuilder... strategies) { + // TODO + return this; + } + + public PlacementStrategyBuilder not(PlacementStrategyBuilder... strategies) { + // TODO + return this; + } + + public PlacementStrategyBuilder orderedOr( + PlacementStrategyBuilder... strategies) { + // TODO + return this; + } + + public PlacementStrategyBuilder delayCriteras( + DelayToNextCriteria... delayToNextCriterias) { + // TODO + return this; + } + + public PlacementStrategyBuilder scope(PlacementSetScope scope) { + // TODO + return this; + } + + public PlacementStrategyBuilder maximumAllocation(int maximumAllocaiton) { + // TODO + return this; + } + + public PlacementStrategyBuilder addAffinityTarget( + AffinityTargetsBuilder builder) { + // TODO + return this; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/ResourceRequestCollectionBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/ResourceRequestCollectionBuilder.java new file mode 100644 index 0000000..c933d18 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/util/guts/ResourceRequestCollectionBuilder.java @@ -0,0 +1,23 @@ +package org.apache.hadoop.yarn.util.guts; + +import org.apache.hadoop.yarn.api.protocolrecords.ResourceRequestCollection; + +import java.util.Map; + +/** + * Created by wtan on 8/8/16. + */ +public class ResourceRequestCollectionBuilder { + Map requests; + + public ResourceRequestCollectionBuilder addRequest(long allocationId, + GutsResourceRequestBuilder requestBuilder) { + requests.put(allocationId, requestBuilder); + return this; + } + + public ResourceRequestCollection build() { + // TODO + return null; + } +}