xintongsong commented on a change in pull request #11353: [FLINK-16438][yarn] 
Make YarnResourceManager starts workers using WorkerResourceSpec requested by 
SlotManager
URL: https://github.com/apache/flink/pull/11353#discussion_r410851560
 
 

 ##########
 File path: 
flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerTest.java
 ##########
 @@ -243,24 +248,33 @@ protected NMClientAsync 
createAndStartNodeManagerClient(YarnConfiguration yarnCo
 
                // domain objects for test purposes
                final ResourceProfile resourceProfile1 = 
ResourceProfile.UNKNOWN;
+               final WorkerResourceSpec workerResourceSpec;
+
+               final Resource containerResource;
 
                public String taskHost = "host1";
 
                final TestingYarnNMClientAsync testingYarnNMClientAsync;
 
                final TestingYarnAMRMClientAsync testingYarnAMRMClientAsync;
 
+               int containerIdx = 0;
+
                /**
                 * Create mock RM dependencies.
                 */
                Context() throws Exception {
-                       this(flinkConfig);
+                       this(flinkConfig, null);
                }
 
-               Context(Configuration configuration) throws  Exception {
-                       final SlotManager slotManager = 
SlotManagerBuilder.newBuilder()
-                               
.setDefaultWorkerResourceSpec(YarnWorkerResourceSpecFactory.INSTANCE.createDefaultWorkerResourceSpec(configuration))
-                               .build();
+               Context(Configuration configuration, @Nullable SlotManager 
slotManager) throws  Exception {
+
+                       workerResourceSpec = 
YarnWorkerResourceSpecFactory.INSTANCE.createDefaultWorkerResourceSpec(configuration);
+                       if (slotManager == null) {
+                               slotManager = SlotManagerBuilder.newBuilder()
+                                       
.setDefaultWorkerResourceSpec(workerResourceSpec)
+                                       .build();
+                       }
 
 Review comment:
   It requires `workerResourceSpec` for creating the default `slotManager`.
   I was trying to avoid creating `workerResourceSpec` twice, in both 
constructors.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to