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