src/App/Entity/CommandRunSummary.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity
  7. *
  8. * @ORM\Table(
  9. * name="command_run_summaries",
  10. * indexes={
  11. *
  12. * @ORM\Index(name="command_name_started_at_idx", columns={"command_name", "started_at"})
  13. * }
  14. * )
  15. */
  16. class CommandRunSummary
  17. {
  18. /**
  19. * @var string
  20. *
  21. * @ORM\GeneratedValue(strategy="CUSTOM")
  22. *
  23. * @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
  24. *
  25. * @ORM\Column(name="id", type="guid")
  26. *
  27. * @ORM\Id
  28. */
  29. protected $id;
  30. /**
  31. * @var string
  32. *
  33. * @ORM\Column(name="command_name", type="string", length=512, nullable=false)
  34. */
  35. protected $commandName;
  36. /**
  37. * @var string
  38. *
  39. * @ORM\Column(name="arguments", type="string", length=1024, nullable=false)
  40. */
  41. protected $arguments;
  42. /**
  43. * @var string
  44. *
  45. * @ORM\Column(name="options", type="string", length=1024, nullable=false)
  46. */
  47. protected $options;
  48. /**
  49. * @var string
  50. *
  51. * @ORM\Column(name="hostname", type="string", length=1024, nullable=false)
  52. */
  53. protected $hostname;
  54. /**
  55. * @var string
  56. *
  57. * @ORM\Column(name="envvars", type="string", length=8192, nullable=false)
  58. */
  59. protected $envvars;
  60. /**
  61. * @var DateTime
  62. *
  63. * @ORM\Column(name="started_at", type="datetime", nullable=false)
  64. */
  65. protected $startedAt;
  66. /**
  67. * @var ?DateTime
  68. *
  69. * @ORM\Column(name="finished_at", type="datetime", nullable=true)
  70. */
  71. protected $finishedAt;
  72. /**
  73. * @var bool
  74. *
  75. * @ORM\Column(name="finished_due_to_no_initial_lock", type="boolean", nullable=false)
  76. */
  77. protected $finishedDueToNoInitialLock;
  78. /**
  79. * @var bool
  80. *
  81. * @ORM\Column(name="finished_due_to_got_behind_lock", type="boolean", nullable=false)
  82. */
  83. protected $finishedDueToGotBehindLock;
  84. /**
  85. * @var bool
  86. *
  87. * @ORM\Column(name="finished_due_to_failed_to_update_lock", type="boolean", nullable=false)
  88. */
  89. protected $finishedDueToFailedToUpdateLock;
  90. /**
  91. * @var bool
  92. *
  93. * @ORM\Column(name="finished_due_to_rollout_signal", type="boolean", nullable=false)
  94. */
  95. protected $finishedDueToRolloutSignal;
  96. /**
  97. * @var bool
  98. *
  99. * @ORM\Column(name="finished_normally", type="boolean", nullable=false)
  100. */
  101. protected $finishedNormally;
  102. /**
  103. * @var int
  104. *
  105. * @ORM\Column(name="number_of_handled_elements", type="integer", nullable=false)
  106. */
  107. protected $numberOfHandledElements;
  108. /**
  109. * @var int|null
  110. */
  111. protected $expectedNumberOfElementsToHandle;
  112. /**
  113. * @var int
  114. *
  115. * @ORM\Column(name="max_allocated_memory", type="integer", nullable=false)
  116. */
  117. protected $maxAllocatedMemory;
  118. public function __construct(
  119. string $commandName,
  120. string $arguments,
  121. string $options,
  122. DateTime $startedAt
  123. ) {
  124. $this->commandName = $commandName;
  125. $this->arguments = $arguments;
  126. $this->options = $options;
  127. $this->hostname = (string)gethostname();
  128. $this->envvars = (string)json_encode(getenv());
  129. $this->startedAt = $startedAt;
  130. $this->finishedDueToNoInitialLock = false;
  131. $this->finishedDueToGotBehindLock = false;
  132. $this->finishedDueToFailedToUpdateLock = false;
  133. $this->finishedDueToRolloutSignal = false;
  134. $this->finishedNormally = false;
  135. $this->numberOfHandledElements = 0;
  136. $this->maxAllocatedMemory = 0;
  137. }
  138. public function getId(): string
  139. {
  140. return $this->id;
  141. }
  142. public function getCommandName(): string
  143. {
  144. return $this->commandName;
  145. }
  146. public function getArguments(): string
  147. {
  148. return $this->arguments;
  149. }
  150. public function getOptions(): string
  151. {
  152. return $this->options;
  153. }
  154. public function setFinishedAt(?DateTime $finishedAt): void
  155. {
  156. $this->finishedAt = $finishedAt;
  157. }
  158. public function setFinishedDueToNoInitialLock(bool $finishedDueToNoInitialLock): void
  159. {
  160. $this->finishedDueToNoInitialLock = $finishedDueToNoInitialLock;
  161. }
  162. public function setFinishedDueToGotBehindLock(bool $finishedDueToGotBehindLock): void
  163. {
  164. $this->finishedDueToGotBehindLock = $finishedDueToGotBehindLock;
  165. }
  166. public function setFinishedDueToFailedToUpdateLock(bool $finishedDueToFailedToUpdateLock): void
  167. {
  168. $this->finishedDueToFailedToUpdateLock = $finishedDueToFailedToUpdateLock;
  169. }
  170. public function setFinishedDueToRolloutSignal(bool $finishedDueToRolloutSignal): void
  171. {
  172. $this->finishedDueToRolloutSignal = $finishedDueToRolloutSignal;
  173. }
  174. public function setFinishedNormally(bool $finishedNormally): void
  175. {
  176. $this->finishedNormally = $finishedNormally;
  177. }
  178. public function getExpectedNumberOfElementsToHandle(): ?int
  179. {
  180. return $this->expectedNumberOfElementsToHandle;
  181. }
  182. public function setExpectedNumberOfElementsToHandle(?int $expectedNumberOfElementsToHandle): void
  183. {
  184. $this->expectedNumberOfElementsToHandle = $expectedNumberOfElementsToHandle;
  185. }
  186. public function setNumberOfHandledElements(int $numberOfHandledElements): void
  187. {
  188. $this->numberOfHandledElements = $numberOfHandledElements;
  189. }
  190. public function getNumberOfHandledElements(): int
  191. {
  192. return $this->numberOfHandledElements;
  193. }
  194. public function setMaxAllocatedMemory(int $maxAllocatedMemory): void
  195. {
  196. $this->maxAllocatedMemory = $maxAllocatedMemory;
  197. }
  198. public function getMaxAllocatedMemory(): int
  199. {
  200. return $this->maxAllocatedMemory;
  201. }
  202. }