You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Meng Zhu (JIRA)" <ji...@apache.org> on 2019/03/18 21:05:00 UTC

[jira] [Commented] (MESOS-9608) Refactor and Improve `class ResourceQuantity`.

    [ https://issues.apache.org/jira/browse/MESOS-9608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16795395#comment-16795395 ] 

Meng Zhu commented on MESOS-9608:
---------------------------------


{noformat}
commit 00dae795c477f8bc2afad9a596263326ed3edd49
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Mar 12 19:06:49 2019 -0700

    Added a method to check `ResourceLimits::contains(ResourceQuantities)`.

    Also added tests.

    Review: https://reviews.apache.org/r/70201

commit 4371ea211bf00d0ea8b9fd8104259fec6f65a133
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Wed Mar 6 17:52:50 2019 -0800

    Added tests for `ResourceLimits`.

    Review: https://reviews.apache.org/r/70152

commit 0433acf23822f691e18b45557fc76521b43053ad
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Wed Mar 6 16:21:40 2019 -0800

    Added `class ResourceLimits`.

    Similar to `ResourceQuantities`. `ResourceLimits`
    is an efficient collection of resource quantities.
    The main difference lies in the absence semantic.
    Absent entry in `ResourceQuantities` implies zero
    quantity while in `ResourceLimits`, it implies no
    limit (i.e. infinite amount). Also, due to the
    absence semantic, zero values in `ResourceLimits`
    are not dropped.

    Review: https://reviews.apache.org/r/70151

commit 4ca29aca090d68c96d41ba4be8b3dc02a2b4cedc
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Wed Mar 6 15:17:47 2019 -0800

    Replaced a constructor in `ResourceQuantities`.

    The constructor constructs `ResourceQuantities`
    from `google::protobuf::Map<std::string, Value::Scalar>`.
    It replaces one of the current constructors that takes
    in `OfferFilters::ResourceQuantities`.

    Review: https://reviews.apache.org/r/70150

commit 22152e48d8adfb60d714bcd4dc8b918ecc1db8a9
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Mar 12 15:26:26 2019 -0700

    Added a `contains` method in `ResourceQuantities`.

    The method checks if the ResourceQuantities object
    contains another ResourceQuantities.

    Also added tests.

    Review: https://reviews.apache.org/r/70149

commit 75b3637445c26e73f130a1566c4d101cda374b2e
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Feb 26 16:52:27 2019 -0800

    Added test for `ResourceQuantities` arithmetic operations.

    Added tests for `+=` and `-=` operators.

    Review: https://reviews.apache.org/r/70063

commit f9d473f36d9983e6d4cdc83e05bba770e5db3451
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Mar 12 16:08:59 2019 -0700

    Improved `ResourceQuantities` test's readability.

    Review: https://reviews.apache.org/r/70069

commit aa7b75fecd336b951fa8577ac5db26d3d0e28c1b
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Feb 26 15:45:08 2019 -0800

    Refactored and augmented `class ResourceQuantities`.

    This patch removed the map interface of
    `class ResourceQuantities`, added a few built-in
    arithmetic operations. Now, absent resource items imply
    there is no (zero) such resources.

    Also added a to-do to add `class ResourceLimits` which
    is similar but treats absent resource entries as having
    infinite amount of such resource.

    Also changed affected call sites and tests accordingly.

    Review: https://reviews.apache.org/r/70062

commit 393f39dd8ea49d0d70e2ca562d8e0a2ab88d5238
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Mar 12 15:25:25 2019 -0700

    Added `>`, `<` and `>=` operators to `Value::Scalar`.

    Review: https://reviews.apache.org/r/70148

commit da1f95714f29165ea603ad109efae4e822c7408a
Author: Meng Zhu <mz...@mesosphere.io>
Date:   Tue Feb 26 15:06:07 2019 -0800

    Added method `fromScalarResources` in `ResourceQuantities`.

    This method takes all the scalar type `Resource` entries in
    the `Resources` and combine them to a `ResourceQuantities`.
    Only the resource name and its scalar value are used and the
    rest of the meta-data is ignored. Non-scalar resource entries
    are silently dropped. Since internal resources are always
    validated to have positive scalar values, this conversion will
    always succeed.

    Also added a dedicated test.

    Review: https://reviews.apache.org/r/70061
{noformat}


> Refactor and Improve `class ResourceQuantity`.
> ----------------------------------------------
>
>                 Key: MESOS-9608
>                 URL: https://issues.apache.org/jira/browse/MESOS-9608
>             Project: Mesos
>          Issue Type: Improvement
>            Reporter: Meng Zhu
>            Assignee: Meng Zhu
>            Priority: Major
>              Labels: resource-management
>
> Currently, the `ResourceQuantity` only provides a minimal map interface with no built-in arithmetic and contains operations. This makes it unwieldy.
> The intention was to avoid the ambiguities between "absent-means-zero" (guarantee like semantic) and "absent-means-infinite" (limits like semantic). Instead of only providing a minimal interface and leave the rest to the caller, we should provide two classes for each semantic:
> - "ResourceQuantities" will have "absent-means-zero" semantic
> - "ResourceLimits" will  have "absent-means-infinite" semantic



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)