You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Benjamin Mahler <bm...@apache.org> on 2018/05/30 00:55:09 UTC

Review Request 67369: Introduced a weighted shuffle algorithm implementation.

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

Review request for mesos, Gaston Kleiman, Greg Mann, and meng han.


Bugs: MESOS-8936
    https://issues.apache.org/jira/browse/MESOS-8936


Repository: mesos


Description
-------

This will be used by the random sorter in order to support weights.


Diffs
-----

  src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 
  src/master/allocator/sorter/random/utils.hpp PRE-CREATION 


Diff: https://reviews.apache.org/r/67369/diff/1/


Testing
-------

Test added in subsequent patch.


Thanks,

Benjamin Mahler


Re: Review Request 67369: Introduced a weighted shuffle algorithm implementation.

Posted by Benjamin Mahler <bm...@apache.org>.

> On May 31, 2018, 7:47 p.m., Meng Zhu wrote:
> > src/master/allocator/sorter/random/utils.hpp
> > Lines 53-59 (patched)
> > <https://reviews.apache.org/r/67369/diff/1/?file=2031732#file2031732line53>
> >
> >     Why do we need to construct the random distribution every time? How about:
> >     
> >     ```
> >     std::uniform_real_distribution<> dis(0.0, 1.0);
> >     for (...) {
> >       ...
> >       keys[i] = 0.0 - std::pow(dis(urbg), (1.0 / weights[i]));
> >     }
> >     ```

It seemed a little more readable to me, and I assumed the cost was very low (e.g. no memory allocation). Would be good to pull it out if that's not the case!


- Benjamin


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


On May 30, 2018, 12:55 a.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/67369/
> -----------------------------------------------------------
> 
> (Updated May 30, 2018, 12:55 a.m.)
> 
> 
> Review request for mesos, Gaston Kleiman, Greg Mann, and Meng Zhu.
> 
> 
> Bugs: MESOS-8936
>     https://issues.apache.org/jira/browse/MESOS-8936
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This will be used by the random sorter in order to support weights.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 
>   src/master/allocator/sorter/random/utils.hpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/67369/diff/1/
> 
> 
> Testing
> -------
> 
> Test added in subsequent patch.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


Re: Review Request 67369: Introduced a weighted shuffle algorithm implementation.

Posted by Meng Zhu <mz...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67369/#review204090
-----------------------------------------------------------




src/master/allocator/sorter/random/utils.hpp
Lines 49 (patched)
<https://reviews.apache.org/r/67369/#comment286476>

    s/-/ - /



src/master/allocator/sorter/random/utils.hpp
Lines 53-59 (patched)
<https://reviews.apache.org/r/67369/#comment286523>

    Why do we need to construct the random distribution every time? How about:
    
    ```
    std::uniform_real_distribution<> dis(0.0, 1.0);
    for (...) {
      ...
      keys[i] = 0.0 - std::pow(dis(urbg), (1.0 / weights[i]));
    }
    ```



src/master/allocator/sorter/random/utils.hpp
Lines 75 (patched)
<https://reviews.apache.org/r/67369/#comment286532>

    ditto


- Meng Zhu


On May 29, 2018, 5:55 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/67369/
> -----------------------------------------------------------
> 
> (Updated May 29, 2018, 5:55 p.m.)
> 
> 
> Review request for mesos, Gaston Kleiman, Greg Mann, and meng han.
> 
> 
> Bugs: MESOS-8936
>     https://issues.apache.org/jira/browse/MESOS-8936
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This will be used by the random sorter in order to support weights.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 
>   src/master/allocator/sorter/random/utils.hpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/67369/diff/1/
> 
> 
> Testing
> -------
> 
> Test added in subsequent patch.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>


Re: Review Request 67369: Introduced a weighted shuffle algorithm implementation.

Posted by Meng Zhu <mz...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67369/#review204153
-----------------------------------------------------------


Ship it!




Ship It!

- Meng Zhu


On May 29, 2018, 5:55 p.m., Benjamin Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/67369/
> -----------------------------------------------------------
> 
> (Updated May 29, 2018, 5:55 p.m.)
> 
> 
> Review request for mesos, Gaston Kleiman, Greg Mann, and Meng Zhu.
> 
> 
> Bugs: MESOS-8936
>     https://issues.apache.org/jira/browse/MESOS-8936
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This will be used by the random sorter in order to support weights.
> 
> 
> Diffs
> -----
> 
>   src/Makefile.am b7184ceccef5f2e985d905c155156f95c7a7c7b4 
>   src/master/allocator/sorter/random/utils.hpp PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/67369/diff/1/
> 
> 
> Testing
> -------
> 
> Test added in subsequent patch.
> 
> 
> Thanks,
> 
> Benjamin Mahler
> 
>