flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trohrm...@apache.org
Subject [flink] branch master updated: [FLINK-14536][core] Sum the cpuCores when merging resource specs
Date Sun, 03 Nov 2019 20:32:27 GMT
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new ba068d5  [FLINK-14536][core] Sum the cpuCores when merging resource specs
ba068d5 is described below

commit ba068d5657f5037ebaa1a4e59491afb89f03f74e
Author: Zhu Zhu <reedpor@gmail.com>
AuthorDate: Sun Nov 3 15:12:27 2019 +0800

    [FLINK-14536][core] Sum the cpuCores when merging resource specs
    
    This closes #10072.
---
 .../main/java/org/apache/flink/api/common/operators/ResourceSpec.java   | 2 +-
 .../java/org/apache/flink/api/common/operators/ResourceSpecTest.java    | 2 ++
 .../flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java       | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
b/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
index 2d56746..6b450fb 100755
--- a/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
@@ -151,7 +151,7 @@ public final class ResourceSpec implements Serializable {
 		}
 
 		ResourceSpec target = new ResourceSpec(
-				Math.max(this.cpuCores, other.cpuCores),
+				this.cpuCores + other.cpuCores,
 				this.heapMemoryInMB + other.heapMemoryInMB,
 				this.directMemoryInMB + other.directMemoryInMB,
 				this.nativeMemoryInMB + other.nativeMemoryInMB,
diff --git a/flink-core/src/test/java/org/apache/flink/api/common/operators/ResourceSpecTest.java
b/flink-core/src/test/java/org/apache/flink/api/common/operators/ResourceSpecTest.java
index b00be49..e232f42 100755
--- a/flink-core/src/test/java/org/apache/flink/api/common/operators/ResourceSpecTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/common/operators/ResourceSpecTest.java
@@ -141,6 +141,8 @@ public class ResourceSpecTest extends TestLogger {
 		ResourceSpec rs2 = ResourceSpec.newBuilder().setCpuCores(1.0).setHeapMemoryInMB(100).build();
 
 		ResourceSpec rs3 = rs1.merge(rs2);
+		assertEquals(2.0, rs3.getCpuCores(), 0.000001);
+		assertEquals(200, rs3.getHeapMemory());
 		assertEquals(1.1, rs3.getGPUResource(), 0.000001);
 
 		ResourceSpec rs4 = rs1.merge(rs3);
diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
index 18b25f7..ab25e5b 100644
--- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
+++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGeneratorTest.java
@@ -275,7 +275,7 @@ public class StreamingJobGraphGeneratorTest extends TestLogger {
 		JobVertex sourceMapFilterVertex = jobGraph.getVerticesSortedTopologicallyFromSources().get(0);
 		JobVertex reduceSinkVertex = jobGraph.getVerticesSortedTopologicallyFromSources().get(1);
 
-		assertTrue(sourceMapFilterVertex.getMinResources().equals(resource1.merge(resource2).merge(resource3)));
+		assertTrue(sourceMapFilterVertex.getMinResources().equals(resource3.merge(resource2).merge(resource1)));
 		assertTrue(reduceSinkVertex.getPreferredResources().equals(resource4.merge(resource5)));
 	}
 


Mime
View raw message