Add command to execute individual job
This commit is contained in:
@@ -4,6 +4,7 @@ Version 1.0.38 (unreleased)
|
|||||||
New features:
|
New features:
|
||||||
|
|
||||||
* User invites
|
* User invites
|
||||||
|
* Add command to execute individual job (mostly for debugging)
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
|||||||
35
app/Console/JobCommand.php
Normal file
35
app/Console/JobCommand.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Kanboard\Console;
|
||||||
|
|
||||||
|
use Kanboard\Core\Queue\JobHandler;
|
||||||
|
use SimpleQueue\Job;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class JobCommand
|
||||||
|
*
|
||||||
|
* @package Kanboard\Console
|
||||||
|
* @author Frederic Guillot
|
||||||
|
*/
|
||||||
|
class JobCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setName('job')
|
||||||
|
->setDescription('Execute individual job (read payload from stdin)')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$payload = fgets(STDIN);
|
||||||
|
|
||||||
|
$job = new Job();
|
||||||
|
$job->unserialize($payload);
|
||||||
|
|
||||||
|
JobHandler::getInstance($this->container)->executeJob($job);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -64,7 +64,7 @@ class QueueManager extends Base
|
|||||||
public function listen()
|
public function listen()
|
||||||
{
|
{
|
||||||
if ($this->queue === null) {
|
if ($this->queue === null) {
|
||||||
throw new LogicException('No queue driver defined!');
|
throw new LogicException('No queue driver defined or unable to connect to broker!');
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($job = $this->queue->pull()) {
|
while ($job = $this->queue->pull()) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Kanboard\ServiceProvider;
|
|||||||
use Kanboard\Console\CronjobCommand;
|
use Kanboard\Console\CronjobCommand;
|
||||||
use Kanboard\Console\DatabaseMigrationCommand;
|
use Kanboard\Console\DatabaseMigrationCommand;
|
||||||
use Kanboard\Console\DatabaseVersionCommand;
|
use Kanboard\Console\DatabaseVersionCommand;
|
||||||
|
use Kanboard\Console\JobCommand;
|
||||||
use Kanboard\Console\LocaleComparatorCommand;
|
use Kanboard\Console\LocaleComparatorCommand;
|
||||||
use Kanboard\Console\LocaleSyncCommand;
|
use Kanboard\Console\LocaleSyncCommand;
|
||||||
use Kanboard\Console\PluginInstallCommand;
|
use Kanboard\Console\PluginInstallCommand;
|
||||||
@@ -52,6 +53,7 @@ class CommandProvider implements ServiceProviderInterface
|
|||||||
$application->add(new TaskTriggerCommand($container));
|
$application->add(new TaskTriggerCommand($container));
|
||||||
$application->add(new CronjobCommand($container));
|
$application->add(new CronjobCommand($container));
|
||||||
$application->add(new WorkerCommand($container));
|
$application->add(new WorkerCommand($container));
|
||||||
|
$application->add(new JobCommand($container));
|
||||||
$application->add(new ResetPasswordCommand($container));
|
$application->add(new ResetPasswordCommand($container));
|
||||||
$application->add(new ResetTwoFactorCommand($container));
|
$application->add(new ResetTwoFactorCommand($container));
|
||||||
$application->add(new PluginUpgradeCommand($container));
|
$application->add(new PluginUpgradeCommand($container));
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Options:
|
|||||||
Available commands:
|
Available commands:
|
||||||
cronjob Execute daily cronjob
|
cronjob Execute daily cronjob
|
||||||
help Displays help for a command
|
help Displays help for a command
|
||||||
|
job Execute individual job (read payload from stdin)
|
||||||
list Lists commands
|
list Lists commands
|
||||||
worker Execute queue worker
|
worker Execute queue worker
|
||||||
db
|
db
|
||||||
@@ -207,6 +208,12 @@ Note: Installed files will have the same permissions as the current user
|
|||||||
./cli worker
|
./cli worker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Execute individual job (mostly for debugging)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo 'RAW_JOB_DATA' | ./cli job
|
||||||
|
```
|
||||||
|
|
||||||
### Execute database migrations
|
### Execute database migrations
|
||||||
|
|
||||||
If the parameter `DB_RUN_MIGRATIONS` is set to `false`, you have run the database migrations manually:
|
If the parameter `DB_RUN_MIGRATIONS` is set to `false`, you have run the database migrations manually:
|
||||||
|
|||||||
Reference in New Issue
Block a user