mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiang Yan Xu <...@jxu.me>
Subject Re: Review Request 45959: Support arithmetic operations for shared resources with consumer counts.
Date Tue, 19 Jul 2016 17:03:24 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45959/#review142652
-----------------------------------------------------------



It would be helpful to add a test just for contains. i.e., to test how `contains` works with
nonshared resources and how it works with simple shared resources (could be constructed from
createDiskResources with no arithmetic operations).

Also as a followup add a benchmark for resource operations. (Let's check with the IBM folks
on their progress in adding DiskInfo and Reservation


src/tests/resources_tests.cpp (lines 2602 - 2603)
<https://reviews.apache.org/r/45959/#comment208277>

    Why adding the two `Resources::parse()` results here?
    
    Can we directly
    
    ```
    Resources r1 = Resources::parse("cpus:40;mem:4096").get() + disk + disk;
    ```
    
    ? This would fit in one line (if it doesn't, use two space indentation).



src/tests/resources_tests.cpp (line 2607)
<https://reviews.apache.org/r/45959/#comment208281>

    s/diff1/diff/ (due to the rename suggestion below).



src/tests/resources_tests.cpp (line 2615)
<https://reviews.apache.org/r/45959/#comment208280>

    How about also throwing in a check for `count`:
    
    ```
    EXPECT_TRUE(diff.count(disk));
    ```



src/tests/resources_tests.cpp (line 2617)
<https://reviews.apache.org/r/45959/#comment208282>

    s/diff2/r/ as it's technically not a diff.



src/tests/resources_tests.cpp (lines 2623 - 2626)
<https://reviews.apache.org/r/45959/#comment208279>

    For completeness let's verify the (pre-)condition before we take the diff.
    
    i.e., add the following above this block.
    
    ```
    EXPECT_EQ(2, r1.count(disk));
    EXPECT_TRUE(r1.contains(disk));
    EXPECT_EQ(1, r2.count(disk));
    EXPECT_TRUE(r2.contains(disk));
    ```



src/tests/resources_tests.cpp (lines 2634 - 2637)
<https://reviews.apache.org/r/45959/#comment208284>

    2 space indentation.



src/tests/resources_tests.cpp (line 2647)
<https://reviews.apache.org/r/45959/#comment208285>

    Seems like this should fail?
    
    This should be true?
    ```
    EXPECT_EQ(r2 - r1 + r1, r2);
    ```



src/tests/resources_tests.cpp (lines 2650 - 2660)
<https://reviews.apache.org/r/45959/#comment208291>

    These feel redundant as ScalarSubtractionShared has covered this case. Remove them?



src/tests/resources_tests.cpp (line 2670)
<https://reviews.apache.org/r/45959/#comment208293>

    s/ScalarSharedNonEqualSharedOperations/ScalarNonEqualSharedOperations/



src/tests/resources_tests.cpp (lines 2679 - 2700)
<https://reviews.apache.org/r/45959/#comment208332>

    Can we directly create r1, r2, r3 and r4 from disk1, disk2 and disk3, i.e., `Resources
r2 = disk1 + disk2;` so each test block is independent so the test is easier to follow?


- Jiang Yan Xu


On July 18, 2016, 7:29 a.m., Anindya Sinha wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45959/
> -----------------------------------------------------------
> 
> (Updated July 18, 2016, 7:29 a.m.)
> 
> 
> Review request for mesos, Benjamin Mahler, Joris Van Remoortere, and Jiang Yan Xu.
> 
> 
> Bugs: MESOS-4892
>     https://issues.apache.org/jira/browse/MESOS-4892
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> A new class Resource_ is added that allows 'Resources' to group
> identical shared resource objects together into a single 'Resource_'
> object and tracked by its shared count. Non-shared resource objects
> are not grouped.
> 
> For resource addition and subtraction, the shared count is adjusted for
> shared resources as follows:
> a) Addition: If shared resource is absent from original, then the
>    resource is added initialized with a consumer count of 1. Otherwise,
>    the share count for the shared resource is incremented.
> b) Subtraction: If shared resource's share count is already 1, then
>    the shared resource is removed from the original. Otherwise, its
>    consumer count is decremented.
> 
> Note that v1 changes for shared resources are in the next commit.
> 
> 
> Diffs
> -----
> 
>   include/mesos/resources.hpp a557e97c65194d4aad879fb88d8edefd1c95b8d8 
>   src/common/resources.cpp f6ff92b591c15bc8e93fd85e1896349c3a7bb968 
>   src/master/validation.cpp 50ba372d1301d16d1738a3e4f4882b51f9ce06cd 
>   src/tests/mesos.hpp e4eccfc3810bed3649a3ab80e252849470de4c72 
>   src/tests/resources_tests.cpp 40d290ac540d26373c5fb7c2a93d27d1aa61d722 
> 
> Diff: https://reviews.apache.org/r/45959/diff/
> 
> 
> Testing
> -------
> 
> New tests added to demonstrate arithmetic operations for shared resources with consumer
counts.
> Tests successful.
> 
> 
> Thanks,
> 
> Anindya Sinha
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message