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