Skip to content

Commit

Permalink
Merge pull request #5 from Vincent-Simonin/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Marc committed Mar 20, 2012
2 parents e751308 + eb575c7 commit c23acd1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions Command/GearmanJobExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ protected function configure()
parent::configure();
$this->setName('gearman:job:execute')
->setDescription('Execute one single job')
->addArgument('job', InputArgument::REQUIRED, 'job to execute');
->addArgument('job', InputArgument::REQUIRED, 'job to execute')
->addOption('no-description', null, InputOption::VALUE_NONE, 'Don\'t print job description');
}

/**
Expand All @@ -43,12 +44,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$input->getOption('no-interaction') && !$dialog->askConfirmation($output, '<question>This will execute asked job?</question>', 'y')) {
return;
}
$output->writeln('<info>loading...</info>');
$output->writeln(sprintf('<info>[%s] loading...</info>', date('Y-m-d H:i:s')));

$job = $input->getArgument('job');
$jobStruct = $this->getContainer()->get('gearman')->getJob($job);
$this->getContainer()->get('gearman.describer')->describeJob($output, $jobStruct, true);
$output->writeln('<info>loaded. Ctrl+C to break</info>');

if (!$input->getOption('no-description')) {
$this->getContainer()->get('gearman.describer')->describeJob($output, $jobStruct, true);
}

$output->writeln(sprintf('<info>[%s] loaded. Ctrl+C to break</info>', date('Y-m-d H:i:s')));
$this->getContainer()->get('gearman.execute')->executeJob($job);
}
}
13 changes: 9 additions & 4 deletions Command/GearmanWorkerExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ protected function configure()
parent::configure();
$this->setName('gearman:worker:execute')
->setDescription('Execute one worker with all contained Jobs')
->addArgument('worker', InputArgument::REQUIRED, 'work to execute');
->addArgument('worker', InputArgument::REQUIRED, 'work to execute')
->addOption('no-description', null, InputOption::VALUE_NONE, 'Don\'t print worker description');
}

/**
Expand All @@ -43,12 +44,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$input->getOption('no-interaction') && !$dialog->askConfirmation($output, '<question>This will execute asked worker with all its jobs?</question>', 'y')) {
return;
}
$output->writeln('<info>loading...</info>');
$output->writeln(sprintf('<info>[%s] loading...</info>', date('Y-m-d H:i:s')));

$worker = $input->getArgument('worker');
$workerStruct = $this->getContainer()->get('gearman')->getWorker($worker);
$this->getContainer()->get('gearman.describer')->describeWorker($output, $workerStruct, true);
$output->writeln('<info>loaded. Ctrl+C to break</info>');

if (!$input->getOption('no-description')) {
$this->getContainer()->get('gearman.describer')->describeWorker($output, $workerStruct, true);
}

$output->writeln(sprintf('<info>[%s] loaded. Ctrl+C to break</info>', date('Y-m-d H:i:s')));
$this->getContainer()->get('gearman.execute')->executeWorker($worker);
}
}

2 comments on commit c23acd1

@Vincent-Simonin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much :-)

@mmoreram
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you ;)

Please sign in to comment.