*/
class GearmanJobDescribeCommand extends ContainerAwareCommand
{
/**
* Console Command configuration
*/
protected function configure()
{
parent::configure();
$this->setName('gearman:job:describe')
->setDescription('Describe given job')
->addArgument('job', InputArgument::REQUIRED, 'job to execute');
}
/**
* Executes the current command.
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return integer 0 if everything went fine, or an error code
*
* @throws \LogicException When this abstract class is not implemented
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$job = $input->getArgument('job');
$worker = $this->getContainer()->get('gearman')->getWorker($job);
$output->writeln('');
$output->writeln(' @Worker\className : '.$worker['className'].'');
$output->writeln(' @Worker\fileName : '.$worker['fileName'].'');
$output->writeln(' @Worker\namespace : '.$worker['namespace'].'');
$output->writeln(' @Worker-jobsnumber : '.count($worker['jobs']).'');
$output->writeln(' @Worker\description :');
$output->writeln('');
$output->writeln(' '.$worker['description'].'');
$output->writeln('');
$job = $worker['job'];
$output->writeln(' @job\methodName : '.$job['methodName'].'');
$output->writeln(' @job\callableName : '.$job['realCallableName'].'');
$output->writeln(' @job\iterations : '.$job['iterations'].'');
$output->writeln(' @job\servers :');
$output->writeln('');
foreach ($job['servers'] as $name => $server) {
$output->writeln(' '.$name.' - '.$server.'');
}
$output->writeln('');
$output->writeln(' @job\description :');
$output->writeln('');
$output->writeln(' '.$job['description'].'');
$output->writeln('');
}
}