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