Page MenuHomePhabricator

D21806.id51974.diff
No OneTemporary

D21806.id51974.diff

diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
@@ -43,11 +43,6 @@
return false;
}
- // TODO: If we have a pending resource which is compatible with the
- // configuration for this lease, prevent a new allocation? Otherwise the
- // queue can fill up with copies of requests from the same lease. But
- // maybe we can deal with this with "pre-leasing"?
-
return true;
}
diff --git a/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php b/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php
@@ -0,0 +1,23 @@
+<?php
+
+final class DrydockLeaseWaitingForActivationLogType extends DrydockLogType {
+
+ const LOGCONST = 'core.lease.waiting-for-activation';
+
+ public function getLogTypeName() {
+ return pht('Waiting For Activation');
+ }
+
+ public function getLogTypeIcon(array $data) {
+ return 'fa-clock-o yellow';
+ }
+
+ public function renderLog(array $data) {
+ $resource_phids = idx($data, 'resourcePHIDs', array());
+
+ return pht(
+ 'Waiting for activation of resources: %s.',
+ $this->renderHandleList($resource_phids));
+ }
+
+}
diff --git a/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php b/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php
@@ -0,0 +1,23 @@
+<?php
+
+final class DrydockLeaseWaitingForReclamationLogType extends DrydockLogType {
+
+ const LOGCONST = 'core.lease.waiting-for-reclamation';
+
+ public function getLogTypeName() {
+ return pht('Waiting For Reclamation');
+ }
+
+ public function getLogTypeIcon(array $data) {
+ return 'fa-clock-o yellow';
+ }
+
+ public function renderLog(array $data) {
+ $resource_phids = idx($data, 'resourcePHIDs', array());
+
+ return pht(
+ 'Waiting for reclamation of resources: %s.',
+ $this->renderHandleList($resource_phids));
+ }
+
+}
diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php
--- a/src/applications/drydock/storage/DrydockLease.php
+++ b/src/applications/drydock/storage/DrydockLease.php
@@ -392,6 +392,62 @@
));
}
+ public function getAllocatedResourcePHIDs() {
+ return $this->getAttribute('internal.resourcePHIDs.allocated', array());
+ }
+
+ public function setAllocatedResourcePHIDs(array $phids) {
+ return $this->setAttribute('internal.resourcePHIDs.allocated', $phids);
+ }
+
+ public function addAllocatedResourcePHIDs(array $phids) {
+ $allocated_phids = $this->getAllocatedResourcePHIDs();
+
+ foreach ($phids as $phid) {
+ $allocated_phids[$phid] = $phid;
+ }
+
+ return $this->setAllocatedResourcePHIDs($allocated_phids);
+ }
+
+ public function removeAllocatedResourcePHIDs(array $phids) {
+ $allocated_phids = $this->getAllocatedResourcePHIDs();
+
+ foreach ($phids as $phid) {
+ unset($allocated_phids[$phid]);
+ }
+
+ return $this->setAllocatedResourcePHIDs($allocated_phids);
+ }
+
+ public function getReclaimedResourcePHIDs() {
+ return $this->getAttribute('internal.resourcePHIDs.reclaimed', array());
+ }
+
+ public function setReclaimedResourcePHIDs(array $phids) {
+ return $this->setAttribute('internal.resourcePHIDs.reclaimed', $phids);
+ }
+
+ public function addReclaimedResourcePHIDs(array $phids) {
+ $reclaimed_phids = $this->getReclaimedResourcePHIDs();
+
+ foreach ($phids as $phid) {
+ $reclaimed_phids[$phid] = $phid;
+ }
+
+ return $this->setReclaimedResourcePHIDs($reclaimed_phids);
+ }
+
+ public function removeReclaimedResourcePHIDs(array $phids) {
+ $reclaimed_phids = $this->getReclaimedResourcePHIDs();
+
+ foreach ($phids as $phid) {
+ unset($reclaimed_phids[$phid]);
+ }
+
+ return $this->setReclaimedResourcePHIDs($reclaimed_phids);
+ }
+
public function setAwakenTaskIDs(array $ids) {
$this->setAttribute('internal.awakenTaskIDs', $ids);
return $this;

File Metadata

Mime Type
text/plain
Expires
Mar 12 2025, 9:15 AM (6 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7581362
Default Alt Text
D21806.id51974.diff (4 KB)

Event Timeline