schmittjoh / JMSJobQueueBundle

Run and Schedule Symfony Console Commands as Background Jobs
http://jmsyst.com/bundles/JMSJobQueueBundle
335 stars 254 forks source link

Too many arguments, expected arguments "command" #173

Closed anboo closed 7 years ago

anboo commented 7 years ago

Symfony:

$ composer show | grep symfony/*
escapestudios/symfony2-coding-standard 2.10.0             CodeSniffer ruleset for the Symfony 2+ coding standard
friendsofsymfony/oauth-server-bundle   1.5.2              Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php            dev-master c50e206 OAuth2 library
matthiasnoback/symfony-config-test     v2.1.0             Library for testing user classes related to the Symfon...
symfony/monolog-bundle                 v3.0.3             Symfony MonologBundle
symfony/phpunit-bridge                 v3.0.9             Symfony PHPUnit Bridge
symfony/polyfill-apcu                  v1.3.0             Symfony polyfill backporting apcu_* functions to lower...
symfony/polyfill-intl-icu              v1.3.0             Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring              v1.3.0             Symfony polyfill for the Mbstring extension
symfony/polyfill-php56                 v1.3.0             Symfony polyfill backporting some PHP 5.6+ features to...
symfony/polyfill-php70                 v1.3.0             Symfony polyfill backporting some PHP 7.0+ features to...
symfony/polyfill-util                  v1.3.0             Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle             v2.4.2             Symfony SwiftmailerBundle
symfony/symfony                        v3.2.8             The Symfony PHP framework

JMS:

$ composer show | grep jms/*
jms/aop-bundle                         1.2.0              Adds AOP capabilities to Symfony2
jms/cg                                 1.2.0              Toolset for generating PHP code
jms/di-extra-bundle                    1.8.1              Allows to configure dependency injection using annotat...
jms/job-queue-bundle                   1.4.1              Allows to schedule Symfony2 console commands as jobs.
jms/metadata                           1.6.0              Class/method/property metadata management in PHP

Code:

        $em = $this->getContainer()->get('doctrine.orm.entity_manager');

        $job = new Job('app:booker:integration-1c:update', [
            '--managerId' => 'booker.1c.account_manager',
            '--convertedData' => '{}',
            '--localId' => '1',
        ]);

        $em->persist($job);
        $em->flush();

Running process:

bin/console jms-job-queue:run -vvv

Output:

Started Job(id = 71, command = "app:booker:integration-1c:update"). Job 71: Too many arguments, expected arguments "command". Job 71: Integration consumer throw Symfony\Component\Console\Exception\RuntimeException input: array ( Job 71: 'iteration' => true, Job 71: 'referenceKey' => NULL, Job 71: 'managerId' => NULL, Job 71: 'convertedData' => NULL, Job 71: 'localId' => NULL, Job 71: 'help' => false, Job 71: 'quiet' => false, Job 71: 'verbose' => true, Job 71: 'version' => false, Job 71: 'ansi' => false, Job 71: 'no-ansi' => false, Job 71: 'no-interaction' => false, Job 71: 'env' => 'dev', Job 71: 'no-debug' => false, Job 71: 'jms-job-id' => '71', Job 71: 'command' => 'app:booker:integration-1c:update', Job 71: ) exception message Too many arguments, expected arguments "command". exception stack trace #0 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Input/ArgvInput.php(88): Symfony\Component\Console\Input\ArgvInput->parseArgument('booker.1c.accou...') Job 71: #1 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Input/Input.php(63): Symfony\Component\Console\Input\ArgvInput->parse() Job 71: #2 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php(222): Symfony\Component\Console\Input\Input->bind(Object(Symfony\Component\Console\Input\InputDefinition)) Job 71: #3 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(853): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) Job 71: #4 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(200): Symfony\Component\Console\Application->doRunCommand(Object(BookerBundle\Command\CRUD\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) Job 71: #5 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) Job 71: #6 /home/anboo/sites/iseeds/api/vendor/jms/job-queue-bundle/JMS/JobQueueBundle/Console/Application.php(45): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) Job 71: #7 /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(124): JMS\JobQueueBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) Job 71: #8 /home/anboo/sites/iseeds/api/bin/console(30): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput)) Job 71: #9 {main} Job 71: Command app:booker:integration-1c:update success Job 71: Job 71: Job 71: Job 71: [Symfony\Component\Console\Exception\RuntimeException] Job 71: Too many arguments, expected arguments "command". Job 71: Job 71: Job 71: Exception trace: Job 71: () at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Input/ArgvInput.php:186 Job 71: Symfony\Component\Console\Input\ArgvInput->parseArgument() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Input/ArgvInput.php:88 Job 71: Symfony\Component\Console\Input\ArgvInput->parse() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Input/Input.php:63 Job 71: Symfony\Component\Console\Input\Input->bind() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:222 Job 71: Symfony\Component\Console\Command\Command->run() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:853 Job 71: Symfony\Component\Console\Application->doRunCommand() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:200 Job 71: Symfony\Component\Console\Application->doRun() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80 Job 71: Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/anboo/sites/iseeds/api/vendor/jms/job-queue-bundle/JMS/JobQueueBundle/Console/Application.php:45 Job 71: JMS\JobQueueBundle\Console\Application->doRun() at /home/anboo/sites/iseeds/api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:124 Job 71: Symfony\Component\Console\Application->run() at /home/anboo/sites/iseeds/api/bin/console:30 Job 71: Job 71: app:booker:integration-1c:update [--iteration [ITERATION]] [-r|--referenceKey [REFERENCEKEY]] [-m|--managerId MANAGERID] [-d|--convertedData CONVERTEDDATA] [-l|--localId LOCALID] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--jms-job-id JMS-JOB-ID] [--] Job 71: Job 71: Job(id = 71, command = "app:booker:integration-1c:update") finished with exit code 1.

Vercryger commented 7 years ago

@anboo I still having the same issue, what was the solution? If no arguments are provided, it works just fine, but even an empty array as param will throw this exception.