You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/05/20 12:24:06 UTC

[GitHub] [flink] zentol opened a new pull request #15975: [FLINK-22646][coordination] SlotManagers unregister metrics in suspend()

zentol opened a new pull request #15975:
URL: https://github.com/apache/flink/pull/15975


   Modified version of #15904.
   
   
   
   Slotmanagers register metrics in start(), but only unregister them in close().
   
   This has 2 issues:
   
   a) If the SM is restarted it cannot re-register the metrics because the old ones are still present; this isn't a critical problem (because the old ones still work) but it produces unnecessary logging noise
   
   b) The metric may produce an NPE when accessed by a reporter during suspend().
   


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     }, {
       "hash" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18306",
       "triggerID" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 54d2002e4ce89e914492d5c16c16b89368d7c1e5 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18306) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #15975: [FLINK-22646][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 043a667b7f4435d6661ac3485789d38ac3607451 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     }, {
       "hash" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252) 
   * 54d2002e4ce89e914492d5c16c16b89368d7c1e5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 043a667b7f4435d6661ac3485789d38ac3607451 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189) 
   * 0c86714da507bf568c23efbb3976b372b142dc79 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c86714da507bf568c23efbb3976b372b142dc79 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22646][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 043a667b7f4435d6661ac3485789d38ac3607451 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] zentol commented on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
zentol commented on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845907064


   The SlotManagerImpl will be removed in 1.14, so there's no value in patching that.
   But I'll keep it in mind for the 1.13 backport.


-- 
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:
users@infra.apache.org



[GitHub] [flink] zentol merged pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
zentol merged pull request #15975:
URL: https://github.com/apache/flink/pull/15975


   


-- 
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:
users@infra.apache.org



[GitHub] [flink] fapaul commented on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
fapaul commented on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845901347


   Why does this issue only affect the `FineGrainedSlotManager` and `DeclarativeSlotMager` when looking at the `SlotManagerImpl` it also calls `suspend` before unregistering the metrics?


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #15975: [FLINK-22646][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845059186


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 043a667b7f4435d6661ac3485789d38ac3607451 (Thu May 20 12:27:25 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c86714da507bf568c23efbb3976b372b142dc79 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210) 
   * c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] fapaul commented on a change in pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
fapaul commented on a change in pull request #15975:
URL: https://github.com/apache/flink/pull/15975#discussion_r636879461



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/DeclarativeSlotManagerTest.java
##########
@@ -1450,6 +1454,34 @@ public void testClearRequirementsClearsResourceTracker() throws Exception {
         }
     }
 
+    @Test
+    public void testMetricsUnregisteredWhenSuspending() throws Exception {
+        testAccessMetricValueDuringItsUnregister(SlotManager::suspend);
+    }
+
+    @Test
+    public void testMetricsUnregisteredWhenClosing() throws Exception {
+        testAccessMetricValueDuringItsUnregister(AutoCloseable::close);
+    }
+
+    private void testAccessMetricValueDuringItsUnregister(
+            ThrowingConsumer<SlotManager, Exception> closeFn) throws Exception {
+        final AtomicInteger registeredMetrics = new AtomicInteger();
+        final MetricRegistry metricRegistry =
+                TestingMetricRegistry.builder()
+                        .setRegisterConsumer((a, b, c) -> registeredMetrics.incrementAndGet())
+                        .setUnregisterConsumer((a, b, c) -> registeredMetrics.decrementAndGet())
+                        .build();
+
+        final DeclarativeSlotManager slotManager =
+                createDeclarativeSlotManagerBuilder()
+                        .setSlotManagerMetricGroup(
+                                SlotManagerMetricGroup.create(metricRegistry, "localhost"))
+                        .buildAndStartWithDirectExec();

Review comment:
       Nit: Assert that metrics number is greater than 0.

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/FineGrainedSlotManagerTest.java
##########
@@ -948,4 +954,41 @@ private void testMaxTotalResourceExceededRegisterResource(
             }
         };
     }
+
+    @Test
+    public void testMetricsUnregisteredWhenSuspending() throws Exception {
+        testAccessMetricValueDuringItsUnregister(SlotManager::suspend);
+    }
+
+    @Test
+    public void testMetricsUnregisteredWhenClosing() throws Exception {
+        testAccessMetricValueDuringItsUnregister(AutoCloseable::close);
+    }
+
+    private void testAccessMetricValueDuringItsUnregister(
+            ThrowingConsumer<SlotManager, Exception> closeFn) throws Exception {
+        final AtomicInteger registeredMetrics = new AtomicInteger();
+        final MetricRegistry metricRegistry =
+                TestingMetricRegistry.builder()
+                        .setRegisterConsumer((a, b, c) -> registeredMetrics.incrementAndGet())
+                        .setUnregisterConsumer((a, b, c) -> registeredMetrics.decrementAndGet())
+                        .build();
+
+        final Context context = new Context();
+        context.setSlotManagerMetricGroup(
+                SlotManagerMetricGroup.create(metricRegistry, "localhost"));
+
+        context.runTest(
+                () -> {
+                    context.runInMainThreadAndWait(
+                            () -> {
+                                try {
+                                    closeFn.accept(context.getSlotManager());

Review comment:
       Nit: Assert that the number of registered metrics is greater than 0 before calling the closing method.




-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 043a667b7f4435d6661ac3485789d38ac3607451 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189) 
   * 0c86714da507bf568c23efbb3976b372b142dc79 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] KarmaGYZ commented on a change in pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
KarmaGYZ commented on a change in pull request #15975:
URL: https://github.com/apache/flink/pull/15975#discussion_r637706827



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/FineGrainedSlotManagerTest.java
##########
@@ -948,4 +955,42 @@ private void testMaxTotalResourceExceededRegisterResource(
             }
         };
     }
+
+    @Test
+    public void testMetricsUnregisteredWhenSuspending() throws Exception {
+        testAccessMetricValueDuringItsUnregister(SlotManager::suspend);
+    }
+
+    @Test
+    public void testMetricsUnregisteredWhenClosing() throws Exception {
+        testAccessMetricValueDuringItsUnregister(AutoCloseable::close);
+    }
+
+    private void testAccessMetricValueDuringItsUnregister(
+            ThrowingConsumer<SlotManager, Exception> closeFn) throws Exception {
+        final AtomicInteger registeredMetrics = new AtomicInteger();
+        final MetricRegistry metricRegistry =
+                TestingMetricRegistry.builder()
+                        .setRegisterConsumer((a, b, c) -> registeredMetrics.incrementAndGet())
+                        .setUnregisterConsumer((a, b, c) -> registeredMetrics.decrementAndGet())
+                        .build();
+
+        final Context context = new Context();
+        context.setSlotManagerMetricGroup(
+                SlotManagerMetricGroup.create(metricRegistry, "localhost"));
+
+        context.runTest(
+                () ->
+                        context.runInMainThreadAndWait(
+                                () -> {
+                                    try {
+                                        // sanity check to ensure metrics were actually registered
+                                        assertThat(registeredMetrics.get(), greaterThan(0));
+                                        closeFn.accept(context.getSlotManager());
+                                        assertThat(registeredMetrics.get(), is(0));
+                                    } catch (Exception e) {
+                                        fail("Error when closing slot manager.");
+                                    }

Review comment:
       Not sure is it a good way to do the sanity check in the `context.runInMainThreadAndWait`. The error from `assertThat` will not be logged.
   
   I think we can leverage a `CompleteFuture` to check whether the close function is done successfully and do the sanity check out of the main thread. Also, we do not need the `runInMainThreadAndWait` in that case.




-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     }, {
       "hash" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18306",
       "triggerID" : "54d2002e4ce89e914492d5c16c16b89368d7c1e5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252) 
   * 54d2002e4ce89e914492d5c16c16b89368d7c1e5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18306) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845059186


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 54d2002e4ce89e914492d5c16c16b89368d7c1e5 (Fri May 28 11:09:47 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c86714da507bf568c23efbb3976b372b142dc79 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210) 
   * c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22646][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 043a667b7f4435d6661ac3485789d38ac3607451 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #15975: [FLINK-22725][coordination] SlotManagers unregister metrics in suspend()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #15975:
URL: https://github.com/apache/flink/pull/15975#issuecomment-845084760


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18189",
       "triggerID" : "043a667b7f4435d6661ac3485789d38ac3607451",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18210",
       "triggerID" : "0c86714da507bf568c23efbb3976b372b142dc79",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252",
       "triggerID" : "c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c7293cdce7b7b106ec0db3f0bc41bf5cac79bf67 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=18252) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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:
users@infra.apache.org