Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
<?php | <?php | ||||
abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO { | abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO { | ||||
// NOTE: If you provide additional fields here, make sure they are handled | // NOTE: If you provide additional fields here, make sure they are handled | ||||
// correctly in the archiving process. | // correctly in the archiving process. | ||||
protected $taskClass; | protected $taskClass; | ||||
protected $leaseOwner; | protected $leaseOwner; | ||||
protected $leaseExpires; | protected $leaseExpires; | ||||
protected $failureCount; | protected $failureCount; | ||||
protected $dataID; | protected $dataID; | ||||
protected $priority; | |||||
private $data; | private $data; | ||||
private $executionException; | private $executionException; | ||||
public function setExecutionException(Exception $execution_exception) { | final public function setExecutionException(Exception $execution_exception) { | ||||
$this->executionException = $execution_exception; | $this->executionException = $execution_exception; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getExecutionException() { | final public function getExecutionException() { | ||||
return $this->executionException; | return $this->executionException; | ||||
} | } | ||||
public function setData($data) { | final public function setData($data) { | ||||
$this->data = $data; | $this->data = $data; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getData() { | final public function getData() { | ||||
return $this->data; | return $this->data; | ||||
} | } | ||||
public function isArchived() { | final public function isArchived() { | ||||
return ($this instanceof PhabricatorWorkerArchiveTask); | return ($this instanceof PhabricatorWorkerArchiveTask); | ||||
} | } | ||||
public function getWorkerInstance() { | final public function getWorkerInstance() { | ||||
$id = $this->getID(); | $id = $this->getID(); | ||||
$class = $this->getTaskClass(); | $class = $this->getTaskClass(); | ||||
if (!class_exists($class)) { | if (!class_exists($class)) { | ||||
throw new PhabricatorWorkerPermanentFailureException( | throw new PhabricatorWorkerPermanentFailureException( | ||||
"Task class '{$class}' does not exist!"); | "Task class '{$class}' does not exist!"); | ||||
} | } | ||||
Show All 9 Lines |