-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55863/#review163448
-----------------------------------------------------------
Fix it, then Ship it!
src/common/protobuf_utils.cpp (lines 332 - 335)
<https://reviews.apache.org/r/55863/#comment234913>
Is there a reason why we don't just mutate it in-place?
```cpp
void adjustOfferOperation(
Offer::Operation* operation,
const Resource::AllocationInfo& allocationInfo);
```
src/common/protobuf_utils.cpp (lines 340 - 341)
<https://reviews.apache.org/r/55863/#comment234909>
I think it'd be clearer for us to write:
```cpp
foreach (TaskInfo& task, *result.launch().mutable_task_infos()) {
// ...
}
```
src/common/protobuf_utils.cpp (lines 343 - 348)
<https://reviews.apache.org/r/55863/#comment234914>
We basically do this for every repeated resources field within `Offer::Operation`. Can
we introduce a function similar to `adjustOfferOperation`?
```cpp
void adjustResources(
RepeatedPtrField<Resource>* resources,
const Resource::AllocationInfo& allocationInfo);
```
The `injectAllocationInfo` helper which operates on `FrameworkInfo`
I think should just be:
```cpp
auto injectAllocationInfo = [](
RepeatedPtrField<Resource>* resources,
const FrameworkInfo& frameworkInfo)
{
if (protobuf::frameworkHasCapability(
frameworkInfo,
FrameworkInfo::Capability::MULTI_ROLE) {
return;
}
Resource::AllocationInfo allocationInfo;
allocationInfo.set_role(frameworkInfo.role);
adjustResources(resources, allocationInfo);
};
```
- Michael Park
On Jan. 23, 2017, 2:59 p.m., Benjamin Mahler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55863/
> -----------------------------------------------------------
>
> (Updated Jan. 23, 2017, 2:59 p.m.)
>
>
> Review request for mesos, Benjamin Bannier, Jay Guo, Guangya Liu, and Michael Park.
>
>
> Bugs: MESOS-6967
> https://issues.apache.org/jira/browse/MESOS-6967
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously, `Resource` did not contain `AllocationInfo`. So for
> backwards compatibility with old schedulers and tooling, we must
> allow operations to contain `Resource`s without an `AllocationInfo`.
>
> This introduces a function which allows the master to inject the
> offer's `AllocationInfo` into the operation's resources.
>
>
> Diffs
> -----
>
> src/common/protobuf_utils.hpp faa7e2a759fd2b1ce5def662679f573ec6fefd28
> src/common/protobuf_utils.cpp dd20759affe3adf2867a33bf875c9ee82862038d
> src/tests/protobuf_utils_tests.cpp bc2a3d0ebe544a58d0de8f2f7174c170113ddf2e
>
> Diff: https://reviews.apache.org/r/55863/diff/
>
>
> Testing
> -------
>
> Added a test.
>
>
> Thanks,
>
> Benjamin Mahler
>
>
|