1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Model; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class QueueWorker. |
7
|
|
|
* |
8
|
|
|
* Placeholder for future Queue Worker that sits and drains the queue |
9
|
|
|
*/ |
10
|
|
|
class Run |
11
|
|
|
{ |
12
|
|
|
protected $id; |
13
|
|
|
protected $startedAt; |
14
|
|
|
protected $endedAt; |
15
|
|
|
protected $elapsed; |
16
|
|
|
protected $duration; // How long to run for in seconds |
17
|
|
|
protected $lastHeartbeatAt; |
18
|
|
|
protected $maxCount; |
19
|
|
|
protected $processed; // Number of jobs processed |
20
|
|
|
protected $hostname; |
21
|
|
|
protected $pid; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @return mixed |
25
|
|
|
*/ |
26
|
|
|
public function getId() |
27
|
|
|
{ |
28
|
|
|
return $this->id; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param mixed $id |
33
|
|
|
*/ |
34
|
|
|
public function setId($id) |
35
|
|
|
{ |
36
|
|
|
$this->id = $id; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return \DateTime|null |
41
|
|
|
*/ |
42
|
|
|
public function getStartedAt() |
43
|
|
|
{ |
44
|
|
|
return $this->startedAt; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param \DateTime $startedAt |
49
|
|
|
*/ |
50
|
|
|
public function setStartedAt(\DateTime $startedAt) |
51
|
|
|
{ |
52
|
|
|
$this->startedAt = $startedAt; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return \DateTime|null |
57
|
|
|
*/ |
58
|
|
|
public function getEndedAt() |
59
|
|
|
{ |
60
|
|
|
return $this->endedAt; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param \DateTime $endedAt |
65
|
|
|
*/ |
66
|
|
|
public function setEndedAt(\DateTime $endedAt) |
67
|
|
|
{ |
68
|
|
|
$this->endedAt = $endedAt; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return int |
73
|
|
|
*/ |
74
|
|
|
public function getDuration() |
75
|
|
|
{ |
76
|
|
|
return $this->duration; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param int $duration |
81
|
|
|
*/ |
82
|
|
|
public function setDuration($duration) |
83
|
|
|
{ |
84
|
|
|
$this->duration = $duration; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return \DateTime|null |
89
|
|
|
*/ |
90
|
|
|
public function getLastHeartbeatAt() |
91
|
|
|
{ |
92
|
|
|
return $this->lastHeartbeatAt; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param \DateTime $lastHeartbeatAt |
97
|
|
|
*/ |
98
|
|
|
public function setLastHeartbeatAt(\DateTime $lastHeartbeatAt) |
99
|
|
|
{ |
100
|
|
|
$this->lastHeartbeatAt = $lastHeartbeatAt; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return int |
105
|
|
|
*/ |
106
|
|
|
public function getMaxCount() |
107
|
|
|
{ |
108
|
|
|
return $this->maxCount; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param int $maxCount |
113
|
|
|
*/ |
114
|
|
|
public function setMaxCount($maxCount) |
115
|
|
|
{ |
116
|
|
|
$this->maxCount = $maxCount; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return int |
121
|
|
|
*/ |
122
|
|
|
public function getProcessed() |
123
|
|
|
{ |
124
|
|
|
return $this->processed; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param int $processed |
129
|
|
|
*/ |
130
|
|
|
public function setProcessed($processed) |
131
|
|
|
{ |
132
|
|
|
$this->processed = $processed; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return string|null |
137
|
|
|
*/ |
138
|
|
|
public function getHostname() |
139
|
|
|
{ |
140
|
|
|
return $this->hostname; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @param string $hostname |
145
|
|
|
*/ |
146
|
|
|
public function setHostname($hostname) |
147
|
|
|
{ |
148
|
|
|
$this->hostname = $hostname; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @return int|null |
153
|
|
|
*/ |
154
|
|
|
public function getPid() |
155
|
|
|
{ |
156
|
|
|
return $this->pid; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @param int $pid |
161
|
|
|
*/ |
162
|
|
|
public function setPid($pid) |
163
|
|
|
{ |
164
|
|
|
$this->pid = $pid; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @return mixed |
169
|
|
|
*/ |
170
|
|
|
public function getElapsed() |
171
|
|
|
{ |
172
|
|
|
return $this->elapsed; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @param mixed $elapsed |
177
|
|
|
*/ |
178
|
|
|
public function setElapsed($elapsed) |
179
|
|
|
{ |
180
|
|
|
$this->elapsed = $elapsed; |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
|