| @@ 24-43 (lines=20) @@ | ||
| 21 | ->addOption('older', null, InputOption::VALUE_REQUIRED, self::OLDER_MESSAGE); |
|
| 22 | } |
|
| 23 | ||
| 24 | protected function execute(InputInterface $input, OutputInterface $output) |
|
| 25 | { |
|
| 26 | $container = $this->getContainer(); |
|
| 27 | $jobManager = $container->get('dtc_queue.job_manager'); |
|
| 28 | $type = $input->getArgument('type'); |
|
| 29 | switch ($type) { |
|
| 30 | case 'error': |
|
| 31 | $count = $jobManager->pruneErroneousJobs(); |
|
| 32 | $output->writeln("$count Erroneous Job(s) pruned"); |
|
| 33 | break; |
|
| 34 | case 'expired': |
|
| 35 | $count = $jobManager->pruneExpiredJobs(); |
|
| 36 | $output->writeln("$count Expired Job(s) pruned"); |
|
| 37 | break; |
|
| 38 | default: |
|
| 39 | return $this->executeStalledOther($input, $output); |
|
| 40 | } |
|
| 41 | ||
| 42 | return 0; |
|
| 43 | } |
|
| 44 | ||
| 45 | public function executeStalledOther(InputInterface $input, OutputInterface $output) |
|
| 46 | { |
|
| @@ 45-64 (lines=20) @@ | ||
| 42 | return 0; |
|
| 43 | } |
|
| 44 | ||
| 45 | public function executeStalledOther(InputInterface $input, OutputInterface $output) |
|
| 46 | { |
|
| 47 | $container = $this->getContainer(); |
|
| 48 | $jobManager = $container->get('dtc_queue.job_manager'); |
|
| 49 | $type = $input->getArgument('type'); |
|
| 50 | switch ($type) { |
|
| 51 | case 'stalled': |
|
| 52 | $count = $jobManager->pruneStalledJobs(); |
|
| 53 | $output->writeln("$count Stalled Job(s) pruned"); |
|
| 54 | break; |
|
| 55 | case 'stalled_runs': |
|
| 56 | $count = $container->get('dtc_queue.run_manager')->pruneStalledRuns(); |
|
| 57 | $output->writeln("$count Stalled Job(s) pruned"); |
|
| 58 | break; |
|
| 59 | default: |
|
| 60 | return $this->executeOlder($input, $output); |
|
| 61 | } |
|
| 62 | ||
| 63 | return 0; |
|
| 64 | } |
|
| 65 | ||
| 66 | public function executeOlder(InputInterface $input, OutputInterface $output) |
|
| 67 | { |
|