Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if ($this->validateState) {
         if (!$input->getOption('ready') && !$input->getOption('buried') && !$input->getOption('delayed')) {
             throw new \RuntimeException('One or more states must be specified. (ready, buried, and/or delayed)');
         }
     }
     if ($this->validateTube) {
         if (!$input->getOption('all') && !$input->getArgument('tube')) {
             throw new \RuntimeException('One or more tubes must be specified.');
         }
     }
     $queue = $this->getQueue();
     if ($input->getOption('all')) {
         $error = false;
         $tubes = $queue->tubes();
         if ($tubes->isEmpty()) {
             $output->writeln('There are no current tubes');
         }
     } else {
         list($tubes, $error) = $this->matchTubeNames($input->getArgument('tube'), $output);
     }
     foreach ($tubes as $tube) {
         $this->forEachTube($tube, $input, $output);
     }
     if ($error) {
         $output->writeln('');
         $this->callCommand($output, ListCommand::NAME);
     }
 }
Example #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $tubes = $this->getQueue()->tubes();
     if ($tubes->isEmpty()) {
         $output->writeln("There are no current tubes");
         return;
     }
     $output->writeln("Current tubes:");
     foreach ($tubes as $tube) {
         $output->writeln(' - ' . $tube->name());
     }
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $queue = $this->getQueue();
     $stats = new ArrayCollection();
     foreach ($input->getArgument('id') as $id) {
         $jobStats = $queue->statsJob($id);
         if ($jobStats->id() !== -1) {
             $stats->add($jobStats);
         } else {
             $output->writeln("Job <info>#{$id}</info> does not exist");
         }
     }
     if (!$stats->isEmpty()) {
         $output->writeln($this->renderStats($stats));
     }
 }
Example #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $refresh = $input->getOption('refresh');
     do {
         list($stats, $error) = $this->getStats($input, $output);
         if ($input->getOption('cron')) {
             $this->logStats($stats);
             return;
         }
         $output->writeln($this->renderStats($stats));
         sleep($refresh ? 1 : 0);
     } while ($refresh);
     if ($error) {
         $output->writeln('');
         $this->callCommand($output, ListCommand::NAME);
     }
 }
Example #5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $stats = $this->getQueue()->statsServer();
     if ($input->getOption('list')) {
         foreach ($stats->getKeys() as $key) {
             $output->writeln($key);
         }
         return;
     }
     if ($input->getOption('stat')) {
         foreach ($input->getOption('stat') as $statName) {
             if (!$stats->containsKey($statName)) {
                 $output->writeln("<error>Stat: \"{$statName}\" does not exist</error>");
                 continue;
             }
             $output->write($stats->get($statName, 0), count($input->getOption('stat')) > 1);
         }
         return;
     }
     $optionNames = ArrayCollection::create(array('current', 'cmd', 'binlog', 'other'));
     if ($optionNames->forAll(function ($key, $value) use($input) {
         return !$input->getOption($value);
     })) {
         $input->setOption('current', true);
         $input->setOption('cmd', true);
         $input->setOption('binlog', true);
         $input->setOption('other', true);
     }
     foreach ($optionNames as $opt) {
         if (!$input->getOption($opt)) {
             continue;
         }
         $this->renderStats($output, $opt, $stats->{"get{$opt}Stats"}());
     }
 }