Homec4science

Improve Drydock's ability to allocate leases correctly

Authored by epriestley <git@epriestley.com> on Dec 13 2012, 03:42.

Description

Improve Drydock's ability to allocate leases correctly

Summary:
Right now, Drydock gives out multiple leases to the same working copy and gives out leases to working copies with repository "P" in them when the user requested some other repository.

Add two callbacks:

  • canAllocateLease() - allows a blueprint to reject a lease on a resource because of a fundamental incompatibility, like "it's a working copy with Phabricator in it, but the lease wants a working copy with Javelin in it".
  • shouldAllocateLease() - allows a blueprint to reject a lease on a resource because of resource limits, like "only one active lease can own a working copy at a time".

Also cleaned up various other things.

Test Plan:
After implementing the callbacks, Drydock has the correct behavior:

  • It gives multiple leases on localhost, but only one lease per working-copy resource.
  • It does not grant leases on resources with repository X to requests for repository Y.

Ran bin/drydock lease --type working-copy --repositoryID 12 and similar repeatedly and verified results in the web console.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D4166

Details

Committed
epriestley <git@epriestley.com>Dec 13 2012, 03:42
Pushed
aubortJan 31 2017, 17:16
Parents
rPH051276a96b08: Minor cleanups to Diffusion breadcrumbs
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHcce5ebebe98b: Improve Drydock's ability to allocate leases correctly (authored by epriestley <git@epriestley.com>).Dec 13 2012, 03:42