@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Formalize some more Drydock conditions and bookkeeping

Summary:
Ref T13677. Track which resources a given lease has begun allocating or reclaiming in a more formal way, and add logging for waiting actions.

The "allocating" mechanism is new. This will replace an existing similar "reclaiming" mechanism in a future change.

Test Plan: See followup changes.

Subscribers: yelirekim, PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13677

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

+106 -5
+4
src/__phutil_library_map__.php
··· 1229 1229 'DrydockLeaseStatus' => 'applications/drydock/constants/DrydockLeaseStatus.php', 1230 1230 'DrydockLeaseUpdateWorker' => 'applications/drydock/worker/DrydockLeaseUpdateWorker.php', 1231 1231 'DrydockLeaseViewController' => 'applications/drydock/controller/DrydockLeaseViewController.php', 1232 + 'DrydockLeaseWaitingForActivationLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php', 1233 + 'DrydockLeaseWaitingForReclamationLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php', 1232 1234 'DrydockLeaseWaitingForResourcesLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php', 1233 1235 'DrydockLog' => 'applications/drydock/storage/DrydockLog.php', 1234 1236 'DrydockLogController' => 'applications/drydock/controller/DrydockLogController.php', ··· 7294 7296 'DrydockLeaseStatus' => 'PhabricatorObjectStatus', 7295 7297 'DrydockLeaseUpdateWorker' => 'DrydockWorker', 7296 7298 'DrydockLeaseViewController' => 'DrydockLeaseController', 7299 + 'DrydockLeaseWaitingForActivationLogType' => 'DrydockLogType', 7300 + 'DrydockLeaseWaitingForReclamationLogType' => 'DrydockLogType', 7297 7301 'DrydockLeaseWaitingForResourcesLogType' => 'DrydockLogType', 7298 7302 'DrydockLog' => array( 7299 7303 'DrydockDAO',
-5
src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
··· 43 43 return false; 44 44 } 45 45 46 - // TODO: If we have a pending resource which is compatible with the 47 - // configuration for this lease, prevent a new allocation? Otherwise the 48 - // queue can fill up with copies of requests from the same lease. But 49 - // maybe we can deal with this with "pre-leasing"? 50 - 51 46 return true; 52 47 } 53 48
+23
src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php
··· 1 + <?php 2 + 3 + final class DrydockLeaseWaitingForActivationLogType extends DrydockLogType { 4 + 5 + const LOGCONST = 'core.lease.waiting-for-activation'; 6 + 7 + public function getLogTypeName() { 8 + return pht('Waiting For Activation'); 9 + } 10 + 11 + public function getLogTypeIcon(array $data) { 12 + return 'fa-clock-o yellow'; 13 + } 14 + 15 + public function renderLog(array $data) { 16 + $resource_phids = idx($data, 'resourcePHIDs', array()); 17 + 18 + return pht( 19 + 'Waiting for activation of resources: %s.', 20 + $this->renderHandleList($resource_phids)); 21 + } 22 + 23 + }
+23
src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php
··· 1 + <?php 2 + 3 + final class DrydockLeaseWaitingForReclamationLogType extends DrydockLogType { 4 + 5 + const LOGCONST = 'core.lease.waiting-for-reclamation'; 6 + 7 + public function getLogTypeName() { 8 + return pht('Waiting For Reclamation'); 9 + } 10 + 11 + public function getLogTypeIcon(array $data) { 12 + return 'fa-clock-o yellow'; 13 + } 14 + 15 + public function renderLog(array $data) { 16 + $resource_phids = idx($data, 'resourcePHIDs', array()); 17 + 18 + return pht( 19 + 'Waiting for reclamation of resources: %s.', 20 + $this->renderHandleList($resource_phids)); 21 + } 22 + 23 + }
+56
src/applications/drydock/storage/DrydockLease.php
··· 392 392 )); 393 393 } 394 394 395 + public function getAllocatedResourcePHIDs() { 396 + return $this->getAttribute('internal.resourcePHIDs.allocated', array()); 397 + } 398 + 399 + public function setAllocatedResourcePHIDs(array $phids) { 400 + return $this->setAttribute('internal.resourcePHIDs.allocated', $phids); 401 + } 402 + 403 + public function addAllocatedResourcePHIDs(array $phids) { 404 + $allocated_phids = $this->getAllocatedResourcePHIDs(); 405 + 406 + foreach ($phids as $phid) { 407 + $allocated_phids[$phid] = $phid; 408 + } 409 + 410 + return $this->setAllocatedResourcePHIDs($allocated_phids); 411 + } 412 + 413 + public function removeAllocatedResourcePHIDs(array $phids) { 414 + $allocated_phids = $this->getAllocatedResourcePHIDs(); 415 + 416 + foreach ($phids as $phid) { 417 + unset($allocated_phids[$phid]); 418 + } 419 + 420 + return $this->setAllocatedResourcePHIDs($allocated_phids); 421 + } 422 + 423 + public function getReclaimedResourcePHIDs() { 424 + return $this->getAttribute('internal.resourcePHIDs.reclaimed', array()); 425 + } 426 + 427 + public function setReclaimedResourcePHIDs(array $phids) { 428 + return $this->setAttribute('internal.resourcePHIDs.reclaimed', $phids); 429 + } 430 + 431 + public function addReclaimedResourcePHIDs(array $phids) { 432 + $reclaimed_phids = $this->getReclaimedResourcePHIDs(); 433 + 434 + foreach ($phids as $phid) { 435 + $reclaimed_phids[$phid] = $phid; 436 + } 437 + 438 + return $this->setReclaimedResourcePHIDs($reclaimed_phids); 439 + } 440 + 441 + public function removeReclaimedResourcePHIDs(array $phids) { 442 + $reclaimed_phids = $this->getReclaimedResourcePHIDs(); 443 + 444 + foreach ($phids as $phid) { 445 + unset($reclaimed_phids[$phid]); 446 + } 447 + 448 + return $this->setReclaimedResourcePHIDs($reclaimed_phids); 449 + } 450 + 395 451 public function setAwakenTaskIDs(array $ids) { 396 452 $this->setAttribute('internal.awakenTaskIDs', $ids); 397 453 return $this;