1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Dtc\GridBundle\Annotation as Grid; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Dtc\QueueBundle\Model\MicrotimeTrait; |
8
|
|
|
use Dtc\QueueBundle\Model\StallableJob; |
9
|
|
|
|
10
|
|
|
abstract class BaseJob extends StallableJob |
11
|
|
|
{ |
12
|
|
|
use MicrotimeTrait; |
13
|
|
|
/** |
14
|
|
|
* @Grid\Column(order=1,sortable=true,searchable=true) |
15
|
|
|
* @ORM\Column(type="bigint") |
16
|
|
|
* @ORM\Id |
17
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
18
|
|
|
*/ |
19
|
|
|
protected $id; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @Grid\Column(sortable=true, searchable=true) |
23
|
|
|
* @ORM\Column(type="string") |
24
|
|
|
*/ |
25
|
|
|
protected $workerName; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @Grid\Column(sortable=true, searchable=true) |
29
|
|
|
* @ORM\Column(type="string") |
30
|
|
|
*/ |
31
|
|
|
protected $className; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @Grid\Column(sortable=true, searchable=true) |
35
|
|
|
* @ORM\Column(type="string") |
36
|
|
|
*/ |
37
|
|
|
protected $method; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @Grid\Column(sortable=true, searchable=true) |
41
|
|
|
* @ORM\Column(type="string") |
42
|
|
|
*/ |
43
|
|
|
protected $status; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @ORM\Column(type="text") |
47
|
|
|
*/ |
48
|
|
|
protected $args; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @Grid\Column(sortable=true,searchable=true) |
52
|
|
|
* @ORM\Column(type="integer", nullable=true) |
53
|
|
|
*/ |
54
|
|
|
protected $priority; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @ORM\Column(type="string") |
58
|
|
|
*/ |
59
|
|
|
protected $crcHash; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* whenAt in Microseconds. |
63
|
|
|
* |
64
|
|
|
* @Grid\Column(sortable=true,order=2) |
65
|
|
|
* @ORM\Column(type="decimal", precision=18, scale=0, nullable=true) |
66
|
|
|
*/ |
67
|
|
|
protected $whenUs; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @Grid\Column(sortable=true) |
71
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
72
|
|
|
*/ |
73
|
|
|
protected $expiresAt; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* When the job started. |
77
|
|
|
* |
78
|
|
|
* @Grid\Column(sortable=true) |
79
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
80
|
|
|
*/ |
81
|
|
|
protected $startedAt; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* When the job finished. |
85
|
|
|
* |
86
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
87
|
|
|
*/ |
88
|
|
|
protected $finishedAt; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @ORM\Column(type="float", nullable=true) |
92
|
|
|
*/ |
93
|
|
|
protected $elapsed; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @ORM\Column(type="text", nullable=true) |
97
|
|
|
*/ |
98
|
|
|
protected $message; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @ORM\Column(type="datetime") |
102
|
|
|
*/ |
103
|
|
|
protected $createdAt; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @ORM\Column(type="datetime") |
107
|
|
|
*/ |
108
|
|
|
protected $updatedAt; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @ORM\Column(type="integer", nullable=true) |
112
|
|
|
*/ |
113
|
|
|
protected $maxDuration; |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @ORM\Column(type="bigint", nullable=true) |
117
|
|
|
*/ |
118
|
|
|
protected $runId; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @ORM\Column(type="integer") |
122
|
|
|
*/ |
123
|
|
|
protected $stalls = 0; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @ORM\Column(type="integer", nullable=true) |
127
|
|
|
*/ |
128
|
|
|
protected $maxStalls; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @ORM\Column(type="integer") |
132
|
|
|
*/ |
133
|
|
|
protected $exceptions = 0; |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @ORM\Column(type="integer", nullable=true) |
137
|
|
|
*/ |
138
|
|
|
protected $maxExceptions; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @ORM\Column(type="integer") |
142
|
|
|
*/ |
143
|
|
|
protected $failures = 0; |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @ORM\Column(type="integer", nullable=true) |
147
|
|
|
*/ |
148
|
|
|
protected $maxFailures; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @ORM\Column(type="integer") |
152
|
|
|
*/ |
153
|
|
|
protected $retries = 0; |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @ORM\Column(type="integer", nullable=true) |
157
|
|
|
*/ |
158
|
|
|
protected $maxRetries; |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return mixed |
162
|
|
|
*/ |
163
|
|
|
public function getRunId() |
164
|
|
|
{ |
165
|
|
|
return $this->runId; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @param mixed $runId |
170
|
|
|
*/ |
171
|
|
|
public function setRunId($runId) |
172
|
|
|
{ |
173
|
|
|
$this->runId = $runId; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function setArgs($args) |
177
|
|
|
{ |
178
|
|
|
$args = serialize($args); |
179
|
|
|
parent::setArgs($args); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function getArgs() |
183
|
|
|
{ |
184
|
|
|
$args = parent::getArgs(); |
185
|
|
|
|
186
|
|
|
return unserialize($args); |
187
|
|
|
} |
188
|
|
|
} |
189
|
|
|
|