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