Page MenuHomePhabricator

Reduce garbage-level of Drydock Allocator implementation
ClosedPublic

Authored by epriestley on Sep 15 2015, 6:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 10:40 PM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Thu, Apr 11, 7:37 AM
Unknown Object (File)
Tue, Apr 9, 10:00 AM
Subscribers

Details

Summary

Ref T9253. The Drydock allocator is very pseudocodey right now. Particularly, it was written before Blueprints were concrete.

Reorganize it to make its responsibilities and error handling behaviors more clear.

In particular, the Allocator does not manage locks. It's primarily trying to reject allocations which can not possibly work. Blueprints are responsible for locks. See some discussion in D10304.

NOTE: This code probably doesn't work as written, see future diffs.
Test Plan

See future diffs.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Reduce garbage-level of Drydock Allocator implementation.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: chad, hach-que.
src/applications/drydock/worker/DrydockAllocatorWorker.php
119–120

There's one major change structural change happening here, and this is the best example of it: previously, we generally didn't involve Blueprints themselves in any of this filtering at all.

A long time ago, Blueprints weren't stored (this was a gross simplifying assumption in v-5 of the code). They were turned into real objects in D7638 but never really threaded through everything fully. This resulted in silliness like this:

$blueprint_implementation->canAllocateMoreResources($pool);

...approximately, on line 136. This is nonsense: the blueprint implementation can not possibly answer that question and $pool is meaningless.

The new code starts with concrete Blueprints and just does a bunch of layers of "does this make sense?" checks, all of which are independently reasonable.

chad edited edge metadata.
This revision is now accepted and ready to land.Sep 15 2015, 6:33 PM
cburroughs added inline comments.
src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
76–78

nit: capitalization

src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
76–78

MAkes me wish we could highlight individual characters.

hach-que edited edge metadata.
epriestley edited edge metadata.
  • Fix capitalization.
This revision was automatically updated to reflect the committed changes.