@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $rootNode |
90 | 90 | ->prototype('variable')->end() |
91 | 91 | ->validate() |
92 | - ->ifTrue(function ($node) { |
|
92 | + ->ifTrue(function($node) { |
|
93 | 93 | if (!is_array($node)) { |
94 | 94 | return true; |
95 | 95 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | ->append($this->addRabbitMqSslOptions()) |
167 | 167 | ->append($this->addRabbitMqArgs()) |
168 | 168 | ->append($this->addRabbitMqExchange()) |
169 | - ->validate()->always(function ($node) { |
|
169 | + ->validate()->always(function($node) { |
|
170 | 170 | if (empty($node['ssl_options'])) { |
171 | 171 | unset($node['ssl_options']); |
172 | 172 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | return $node; |
178 | 178 | })->end() |
179 | - ->validate()->ifTrue(function ($node) { |
|
179 | + ->validate()->ifTrue(function($node) { |
|
180 | 180 | if (isset($node['ssl_options']) && !$node['ssl']) { |
181 | 181 | return true; |
182 | 182 | } |
@@ -24,6 +24,9 @@ |
||
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | + /** |
|
28 | + * @param string $type |
|
29 | + */ |
|
27 | 30 | protected function validateManagerType($type) |
28 | 31 | { |
29 | 32 | $managerType = $this->container->getParameter($type); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | $format = $this->getDateFormat($type); |
83 | - usort($timingsDates, function ($date1str, $date2str) use ($format) { |
|
83 | + usort($timingsDates, function($date1str, $date2str) use ($format) { |
|
84 | 84 | $date1 = \DateTime::createFromFormat($format, $date1str); |
85 | 85 | $date2 = \DateTime::createFromFormat($format, $date2str); |
86 | 86 | if (!$date2) { |
@@ -36,7 +36,6 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @Route("/timings", name="dtc_queue_timings") |
38 | 38 | * |
39 | - * @param Request $request |
|
40 | 39 | */ |
41 | 40 | public function getTimingsAction() |
42 | 41 | { |
@@ -56,6 +55,10 @@ discard block |
||
56 | 55 | return new JsonResponse($params); |
57 | 56 | } |
58 | 57 | |
58 | + /** |
|
59 | + * @param \DateTime|null $beginDate |
|
60 | + * @param \DateTime $endDate |
|
61 | + */ |
|
59 | 62 | protected function calculateTimings($type, $beginDate, $endDate) |
60 | 63 | { |
61 | 64 | $params = []; |
@@ -105,7 +108,7 @@ discard block |
||
105 | 108 | * Timings offset by timezone if necessary. |
106 | 109 | * |
107 | 110 | * @param array $timingsDates |
108 | - * @param $format |
|
111 | + * @param string $format |
|
109 | 112 | * |
110 | 113 | * @return array |
111 | 114 | */ |
@@ -54,6 +54,9 @@ discard block |
||
54 | 54 | $this->addLiveJobs($container); |
55 | 55 | } |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $type |
|
59 | + */ |
|
57 | 60 | protected function setupAlias(ContainerBuilder $container, $defaultManagerType, $type) |
58 | 61 | { |
59 | 62 | $definitionName = 'dtc_queue.'.$type.'.'.$defaultManagerType; |
@@ -84,7 +87,6 @@ discard block |
||
84 | 87 | |
85 | 88 | /** |
86 | 89 | * @param ContainerBuilder $container |
87 | - * @param Reference[] $jobManagerRef |
|
88 | 90 | * @param string $jobClass |
89 | 91 | */ |
90 | 92 | protected function setupTaggedServices(ContainerBuilder $container, Definition $definition, $jobClass) |
@@ -212,6 +214,11 @@ discard block |
||
212 | 214 | return $managerType; |
213 | 215 | } |
214 | 216 | |
217 | + /** |
|
218 | + * @param string $managerType |
|
219 | + * @param string $type |
|
220 | + * @param string $className |
|
221 | + */ |
|
215 | 222 | protected function getClass(ContainerBuilder $container, $managerType, $type, $className, $baseClass) |
216 | 223 | { |
217 | 224 | $runClass = $container->hasParameter('dtc_queue.class_'.$type) ? $container->getParameter('dtc_queue.class_'.$type) : null; |
@@ -365,6 +365,10 @@ discard block |
||
365 | 365 | return $workersMethods; |
366 | 366 | } |
367 | 367 | |
368 | + /** |
|
369 | + * @param string $workerName |
|
370 | + * @param string $methodName |
|
371 | + */ |
|
368 | 372 | public function countLiveJobs($workerName = null, $methodName = null) |
369 | 373 | { |
370 | 374 | /** @var DocumentManager $objectManager */ |
@@ -378,6 +382,11 @@ discard block |
||
378 | 382 | return $builder->getQuery()->count(); |
379 | 383 | } |
380 | 384 | |
385 | + /** |
|
386 | + * @param string $workerName |
|
387 | + * @param string $methodName |
|
388 | + * @param \Closure $progressCallback |
|
389 | + */ |
|
381 | 390 | public function archiveAllJobs($workerName = null, $methodName = null, $progressCallback) |
382 | 391 | { |
383 | 392 | /** @var DocumentManager $documentManager */ |
@@ -242,6 +242,7 @@ discard block |
||
242 | 242 | * @param string $workerName |
243 | 243 | * @param string $methodName |
244 | 244 | * @param bool $prioritize |
245 | + * @param integer $runId |
|
245 | 246 | * |
246 | 247 | * @return Job|null |
247 | 248 | */ |
@@ -268,8 +269,8 @@ discard block |
||
268 | 269 | } |
269 | 270 | |
270 | 271 | /** |
271 | - * @param null $workerName |
|
272 | - * @param null $methodName |
|
272 | + * @param string|null $workerName |
|
273 | + * @param string|null $methodName |
|
273 | 274 | * @param bool $prioritize |
274 | 275 | * |
275 | 276 | * @return QueryBuilder |
@@ -346,7 +347,7 @@ discard block |
||
346 | 347 | * |
347 | 348 | * @param \Dtc\QueueBundle\Model\Job $job |
348 | 349 | * |
349 | - * @return mixed|null |
|
350 | + * @return null|Job |
|
350 | 351 | */ |
351 | 352 | public function updateNearestBatch(\Dtc\QueueBundle\Model\Job $job) |
352 | 353 | { |
@@ -375,6 +376,10 @@ discard block |
||
375 | 376 | return $existingJob; |
376 | 377 | } |
377 | 378 | |
379 | + /** |
|
380 | + * @param integer $newPriority |
|
381 | + * @param null|\DateTime $newWhenAt |
|
382 | + */ |
|
378 | 383 | protected function updateBatchJob(Job $existingJob, $newPriority, $newWhenAt) |
379 | 384 | { |
380 | 385 | $existingPriority = $existingJob->getPriority(); |
@@ -426,6 +431,10 @@ discard block |
||
426 | 431 | return $workerMethods; |
427 | 432 | } |
428 | 433 | |
434 | + /** |
|
435 | + * @param string $workerName |
|
436 | + * @param string $methodName |
|
437 | + */ |
|
429 | 438 | public function countLiveJobs($workerName = null, $methodName = null) |
430 | 439 | { |
431 | 440 | /** @var EntityRepository $repository */ |
@@ -438,6 +447,11 @@ discard block |
||
438 | 447 | return $queryBuilder->getQuery()->getSingleScalarResult(); |
439 | 448 | } |
440 | 449 | |
450 | + /** |
|
451 | + * @param string $workerName |
|
452 | + * @param string $methodName |
|
453 | + * @param \Closure $progressCallback |
|
454 | + */ |
|
441 | 455 | public function archiveAllJobs($workerName = null, $methodName = null, $progressCallback) |
442 | 456 | { |
443 | 457 | // First mark all Live non-running jobs as Archive |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Doctrine\ORM\EntityManager; |
6 | 6 | use Doctrine\ORM\EntityRepository; |
7 | -use Doctrine\ORM\Query; |
|
8 | 7 | use Doctrine\ORM\QueryBuilder; |
9 | 8 | use Dtc\QueueBundle\Doctrine\BaseJobManager; |
10 | 9 | use Dtc\QueueBundle\Entity\Job; |
@@ -35,6 +35,9 @@ |
||
35 | 35 | return parent::getColumns(); |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param boolean $flag |
|
40 | + */ |
|
38 | 41 | public function setRunning($flag) |
39 | 42 | { |
40 | 43 | $this->running = $flag; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $queryBuilder->where('j.status = :status')->setParameter(':status', BaseJob::STATUS_RUNNING); |
55 | 55 | $queryBuilder->orderBy('j.startedAt', 'DESC'); |
56 | 56 | $queryBuilder->setFirstResult($this->offset) |
57 | - ->setMaxResults($this->limit); |
|
57 | + ->setMaxResults($this->limit); |
|
58 | 58 | |
59 | 59 | return $queryBuilder; |
60 | 60 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $queryBuilder = $this->jobManager->getJobQueryBuilder(); |
69 | 69 | $queryBuilder->add('select', 'j'); |
70 | 70 | $queryBuilder->setFirstResult($this->offset) |
71 | - ->setMaxResults($this->limit); |
|
71 | + ->setMaxResults($this->limit); |
|
72 | 72 | |
73 | 73 | return $queryBuilder; |
74 | 74 | } |
@@ -60,13 +60,13 @@ |
||
60 | 60 | $methodName = $request->get('method'); |
61 | 61 | |
62 | 62 | $jobManager = $this->get('dtc_queue.job_manager'); |
63 | - $callback = function ($count) { |
|
63 | + $callback = function($count) { |
|
64 | 64 | echo json_encode(['count' => $count]); |
65 | 65 | echo "\n"; |
66 | 66 | flush(); |
67 | 67 | }; |
68 | 68 | |
69 | - return new StreamedResponse(function () use ($jobManager, $callback, $workerName, $methodName) { |
|
69 | + return new StreamedResponse(function() use ($jobManager, $callback, $workerName, $methodName) { |
|
70 | 70 | $total = $jobManager->countLiveJobs($workerName, $methodName); |
71 | 71 | echo json_encode(['total' => $total]); |
72 | 72 | echo "\n"; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $total += count($this->jobs[$jobWorkerName]); |
37 | 37 | } |
38 | 38 | |
39 | - return array_sum(array_map(function ($jobs) { |
|
39 | + return array_sum(array_map(function($jobs) { |
|
40 | 40 | return count($jobs); |
41 | 41 | }, $this->jobs)); |
42 | 42 | } |