|
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
|
|
|
protected $processTimeout; |
|
23
|
|
|
protected $currentJobId; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @return mixed |
|
27
|
|
|
*/ |
|
28
|
15 |
|
public function getId() |
|
29
|
|
|
{ |
|
30
|
15 |
|
return $this->id; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param mixed $id |
|
35
|
|
|
*/ |
|
36
|
14 |
|
public function setId($id) |
|
37
|
|
|
{ |
|
38
|
14 |
|
$this->id = $id; |
|
39
|
14 |
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return \DateTime|null |
|
43
|
|
|
*/ |
|
44
|
9 |
|
public function getStartedAt() |
|
45
|
|
|
{ |
|
46
|
9 |
|
return $this->startedAt; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param \DateTime $startedAt |
|
51
|
|
|
*/ |
|
52
|
6 |
|
public function setStartedAt(\DateTime $startedAt) |
|
53
|
|
|
{ |
|
54
|
6 |
|
$this->startedAt = $startedAt; |
|
55
|
6 |
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return \DateTime|null |
|
59
|
|
|
*/ |
|
60
|
9 |
|
public function getEndedAt() |
|
61
|
|
|
{ |
|
62
|
9 |
|
return $this->endedAt; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param \DateTime $endedAt |
|
67
|
|
|
*/ |
|
68
|
8 |
|
public function setEndedAt(\DateTime $endedAt) |
|
69
|
|
|
{ |
|
70
|
8 |
|
$this->endedAt = $endedAt; |
|
71
|
8 |
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* @return int |
|
75
|
|
|
*/ |
|
76
|
14 |
|
public function getDuration() |
|
77
|
|
|
{ |
|
78
|
14 |
|
return $this->duration; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param int $duration |
|
83
|
|
|
*/ |
|
84
|
7 |
|
public function setDuration($duration) |
|
85
|
|
|
{ |
|
86
|
7 |
|
$this->duration = $duration; |
|
87
|
7 |
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return \DateTime|null |
|
91
|
|
|
*/ |
|
92
|
9 |
|
public function getLastHeartbeatAt() |
|
93
|
|
|
{ |
|
94
|
9 |
|
return $this->lastHeartbeatAt; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @param \DateTime $lastHeartbeatAt |
|
99
|
|
|
*/ |
|
100
|
9 |
|
public function setLastHeartbeatAt(\DateTime $lastHeartbeatAt) |
|
101
|
|
|
{ |
|
102
|
9 |
|
$this->lastHeartbeatAt = $lastHeartbeatAt; |
|
103
|
9 |
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @return int |
|
107
|
|
|
*/ |
|
108
|
14 |
|
public function getMaxCount() |
|
109
|
|
|
{ |
|
110
|
14 |
|
return $this->maxCount; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @param int $maxCount |
|
115
|
|
|
*/ |
|
116
|
8 |
|
public function setMaxCount($maxCount) |
|
117
|
|
|
{ |
|
118
|
8 |
|
$this->maxCount = $maxCount; |
|
119
|
8 |
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @return int |
|
123
|
|
|
*/ |
|
124
|
15 |
|
public function getProcessed() |
|
125
|
|
|
{ |
|
126
|
15 |
|
return $this->processed; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @param int $processed |
|
131
|
|
|
*/ |
|
132
|
11 |
|
public function setProcessed($processed) |
|
133
|
|
|
{ |
|
134
|
11 |
|
$this->processed = $processed; |
|
135
|
11 |
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @return string|null |
|
139
|
|
|
*/ |
|
140
|
15 |
|
public function getHostname() |
|
141
|
|
|
{ |
|
142
|
15 |
|
return $this->hostname; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param string $hostname |
|
147
|
|
|
*/ |
|
148
|
8 |
|
public function setHostname($hostname) |
|
149
|
|
|
{ |
|
150
|
8 |
|
$this->hostname = $hostname; |
|
151
|
8 |
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @return int|null |
|
155
|
|
|
*/ |
|
156
|
14 |
|
public function getPid() |
|
157
|
|
|
{ |
|
158
|
14 |
|
return $this->pid; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @param int $pid |
|
163
|
|
|
*/ |
|
164
|
8 |
|
public function setPid($pid) |
|
165
|
|
|
{ |
|
166
|
8 |
|
$this->pid = $pid; |
|
167
|
8 |
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @return mixed |
|
171
|
|
|
*/ |
|
172
|
15 |
|
public function getElapsed() |
|
173
|
|
|
{ |
|
174
|
15 |
|
return $this->elapsed; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* @param mixed $elapsed |
|
179
|
|
|
*/ |
|
180
|
8 |
|
public function setElapsed($elapsed) |
|
181
|
|
|
{ |
|
182
|
8 |
|
$this->elapsed = $elapsed; |
|
183
|
8 |
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @return mixed |
|
187
|
|
|
*/ |
|
188
|
14 |
|
public function getProcessTimeout() |
|
189
|
|
|
{ |
|
190
|
14 |
|
return $this->processTimeout; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* @param mixed $processTimeout |
|
195
|
|
|
*/ |
|
196
|
8 |
|
public function setProcessTimeout($processTimeout) |
|
197
|
|
|
{ |
|
198
|
8 |
|
$this->processTimeout = $processTimeout; |
|
199
|
8 |
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* @return mixed |
|
203
|
|
|
*/ |
|
204
|
14 |
|
public function getCurrentJobId() |
|
205
|
|
|
{ |
|
206
|
14 |
|
return $this->currentJobId; |
|
207
|
|
|
} |
|
208
|
|
|
|
|
209
|
|
|
/** |
|
210
|
|
|
* @param mixed $currentJobId |
|
211
|
|
|
*/ |
|
212
|
10 |
|
public function setCurrentJobId($currentJobId) |
|
213
|
|
|
{ |
|
214
|
10 |
|
$this->currentJobId = $currentJobId; |
|
215
|
10 |
|
} |
|
216
|
|
|
} |
|
217
|
|
|
|