Guikingone / SchedulerBundle

Repetitive tasks as a breath in Symfony
MIT License
111 stars 10 forks source link

WARNING: The task "..." cannot be created as an existing one has been found #70

Closed MarcelWilhelmi closed 3 years ago

MarcelWilhelmi commented 3 years ago

Hi there, it's me again :-)

I finally tested the doctrine transport with release version 0.4.1. Everything seems to work fine so far. A new table has been created successfully by using auto_setup=true. Thank you very much :-)

One little thing: With every run of scheduler:consume the following warning is being logged for each task: WARNING: The task "..." cannot be created as an existing one has been found The warning is being logged in the Connection.php create($task) function. I guess this isn't the intended behavior, right?

Best regards Marcel

Guikingone commented 3 years ago

Hi @MarcelWilhelmi 👋🏻

Can you add more informations about the context:

Thanks 🙂

MarcelWilhelmi commented 3 years ago

Hi @Guikingone of course I can :-)

Dependencies (composer show):

brick/math 0.9.2 Arbitrary-precision arithmetic library clue/stream-filter v1.5.0 A simple and modern approach to stream filtering in PHP composer/package-versions-deprecated 1.11.99.1 Composer plugin that provides efficient querying for installed package versi... composer/semver 3.2.4 Semver library that offers utilities, version constraint parsing and validat... composer/xdebug-handler 2.0.0 Restarts a process without Xdebug. container-interop/container-interop 1.2.0 Promoting the interoperability of container objects (DIC, SL, etc.) doctrine/annotations 1.12.1 Docblock Annotations Parser doctrine/cache 1.10.2 PHP Doctrine Cache library is a popular cache implementation that supports m... doctrine/collections 1.6.7 PHP Doctrine Collections library that adds additional functionality on top o... doctrine/common 3.1.2 PHP Doctrine Common project is a library that provides additional functional... doctrine/dbal 2.13.1 Powerful PHP database abstraction layer (DBAL) with many features for databa... doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging wi... doctrine/doctrine-bundle 2.3.1 Symfony DoctrineBundle doctrine/doctrine-migrations-bundle 3.1.1 Symfony DoctrineMigrationsBundle doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be... doctrine/inflector 2.0.3 PHP Doctrine Inflector is a small library that can perform string manipulati... doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PHP without invoking ... doctrine/lexer 1.2.1 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive De... doctrine/migrations 3.1.1 PHP Doctrine Migrations project offer additional functionality on top of the... doctrine/orm 2.8.4 Object-Relational-Mapper for PHP doctrine/persistence 2.1.0 The Doctrine Persistence project is a set of shared interfaces and functiona... doctrine/sql-formatter 1.1.1 a PHP SQL highlighting library dragonmantank/cron-expression v3.1.0 CRON for PHP: Calculate the next or previous run date and determine if a CRO... dsiddharth2/php-zxing 1.0.3 Wrapper for zxing using php egulias/email-validator 3.1.1 A library for validating emails against several RFCs fpdf/fpdf 1.82.1 FPDF Composer Wrapper friendsofphp/php-cs-fixer v2.18.6 A tool to automatically fix PHP code style friendsofphp/proxy-manager-lts v1.0.3 Adding support for a wider range of PHP versions to ocramius/proxy-manager giggsey/libphonenumber-for-php 8.12.21 PHP Port of Google's libphonenumber giggsey/locale 1.9 Locale functions required by libphonenumber-for-php guikingone/scheduler-bundle 0.4.1 A Symfony bundle that allows to schedule and create repetitive tasks guzzlehttp/guzzle 7.3.0 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.4.1 Guzzle promises library guzzlehttp/psr7 1.8.1 PSR-7 message implementation that also provides common utility methods http-interop/http-factory-guzzle 1.0.0 An HTTP Factory using Guzzle PSR7 imagine/imagine v0.5.0 Image processing for PHP 5.3 jean85/pretty-package-versions 2.0.3 A library to get pretty versions strings of installed dependencies laminas/laminas-code 4.2.0 Extensions to the PHP Reflection API, static code scanning, and code generation laminas/laminas-eventmanager 3.3.1 Trigger and listen to events within a PHP application laminas/laminas-zendframework-bridge 1.2.0 Alias legacy ZF class names to Laminas Project equivalents. monolog/monolog 2.2.0 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects myclabs/php-enum 1.8.0 PHP Enum implementation nesbot/carbon 2.46.0 An API extension for DateTime that supports 281 different languages. nikic/php-parser v4.10.4 A PHP parser written in PHP phar-io/manifest 2.0.1 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.1.0 Library for handling version information and constraints php-cs-fixer/diff v1.3.1 sebastian/diff v2 backport support for PHP5.6 php-http/client-common 2.3.0 Common HTTP Client implementations and tools for HTTPlug php-http/discovery 1.13.0 Finds installed HTTPlug implementations and PSR-7 message factories php-http/httplug 2.2.0 HTTPlug, the HTTP client abstraction for PHP php-http/message 1.11.0 HTTP Message related tools php-http/message-factory v1.0.2 Factory interfaces for PSR-7 HTTP Message php-http/promise 1.1.0 Promise used for asynchronous HTTP requests php-imap/php-imap 4.1.0 Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP) phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.2.2 With this component, a library can provide support for annotations via DocBl... phpdocumentor/type-resolver 1.4.0 A PSR-5 based resolver of Class names, Types and Structural Element Names phpspec/prophecy 1.13.0 Highly opinionated mocking framework for PHP 5.3+ phpstan/phpstan 0.12.84 PHPStan - PHP Static Analysis Tool phpunit/php-code-coverage 9.2.6 Library that provides collection, processing, and rendering functionality fo... phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.1.1 Invoke callables with a timeout phpunit/php-text-template 2.0.4 Simple template engine. phpunit/php-timer 5.0.3 Utility class for timing phpunit/phpunit 9.5.4 The PHP Unit Testing framework. psr/cache 1.0.1 Common interface for caching libraries psr/container 1.1.1 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.1 Common interface for HTTP clients psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.0.1 Common interface for HTTP messages psr/log 1.1.3 Common interface for logging libraries ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 1.1.3 A PHP 7.2+ library for representing and manipulating collections. ramsey/uuid 4.1.1 A PHP library for generating and working with universally unique identifiers... sentry/sdk 3.1.0 This is a metapackage shipping sentry/sentry with a recommended HTTP client. sentry/sentry 3.2.1 A PHP SDK for Sentry (http://sentry.io) sentry/sentry-symfony 4.1.0 Symfony integration for Sentry (http://getsentry.com) spatie/pdf-to-text 1.4.0 Extract text from a pdf squizlabs/php_codesniffer 3.6.0 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violatio... symfony/asset v5.2.4 Manages URL generation and versioning of web assets such as CSS stylesheets,... symfony/cache v5.2.6 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v2.4.0 Generic abstractions related to caching symfony/config v5.2.4 Helps you find, load, combine, autofill and validate configuration values of... symfony/console v5.2.6 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.2.4 Converts CSS selectors to XPath expressions symfony/dependency-injection v5.2.6 Allows you to standardize and centralize the way objects are constructed in ... symfony/deprecation-contracts v2.4.0 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v5.2.6 Provides integration for Doctrine with various Symfony components symfony/dom-crawler v5.2.4 Eases DOM navigation for HTML and XML documents symfony/dotenv v5.2.4 Registers environment variables from a .env file symfony/error-handler v5.2.6 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v5.2.4 Provides tools that allow your application components to communicate with ea... symfony/event-dispatcher-contracts v2.4.0 Generic abstractions related to dispatching event symfony/filesystem v5.2.6 Provides basic utilities for the filesystem symfony/finder v5.2.4 Finds files and directories via an intuitive fluent interface symfony/flex v1.12.2 Composer plugin for Symfony symfony/framework-bundle v5.2.6 Provides a tight integration between Symfony components and the Symfony full... symfony/http-client v5.2.6 Provides powerful methods to fetch HTTP resources synchronously or asynchron... symfony/http-client-contracts v2.4.0 Generic abstractions related to HTTP clients symfony/http-foundation v5.2.4 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v5.2.6 Provides a structured process for converting a Request into a Response symfony/lock v5.2.6 Creates and manages locks, a mechanism to provide exclusive access to a shar... symfony/mailer v5.2.6 Helps sending emails symfony/maker-bundle v1.30.2 Symfony Maker helps you create empty commands, controllers, form classes, te... symfony/mime v5.2.6 Allows manipulating MIME messages symfony/monolog-bridge v5.2.5 Provides integration for Monolog with various Symfony components symfony/monolog-bundle v3.7.0 Symfony MonologBundle symfony/options-resolver v5.2.4 Provides an improved replacement for the arrayreplace PHP function symfony/orm-pack v2.1.0 A pack for the Doctrine ORM symfony/polyfill-intl-grapheme v1.22.1 Symfony polyfill for intl's grapheme* functions symfony/polyfill-intl-idn v1.22.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.22.1 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.22.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.22.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.22.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.22.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-uuid v1.22.1 Symfony polyfill for uuid functions symfony/process v5.2.4 Executes commands in sub-processes symfony/profiler-pack v1.0.5 A pack for the Symfony web profiler symfony/property-access v5.2.4 Provides functions to read and write from/to an object or array using a simp... symfony/property-info v5.2.4 Extracts information about PHP class' properties using metadata of popular s... symfony/proxy-manager-bridge v5.2.4 Provides integration for ProxyManager with various Symfony components symfony/psr-http-message-bridge v2.1.0 PSR HTTP message bridge symfony/routing v5.2.6 Maps an HTTP request to a set of configuration variables symfony/security-bundle v5.2.6 Provides a tight integration of the Security component into the Symfony full... symfony/security-core v5.2.6 Symfony Security Component - Core Library symfony/security-csrf v5.2.4 Symfony Security Component - CSRF Library symfony/security-guard v5.2.4 Symfony Security Component - Guard symfony/security-http v5.2.6 Symfony Security Component - HTTP Integration symfony/serializer v5.2.4 Handles serializing and deserializing data structures, including object grap... symfony/serializer-pack v1.0.4 A pack for the Symfony serializer symfony/service-contracts v2.4.0 Generic abstractions related to writing services symfony/stopwatch v5.2.4 Provides a way to profile code symfony/string v5.2.6 Provides an object-oriented API to strings and deals with bytes, UTF-8 code ... symfony/translation v5.2.6 Provides tools to internationalize your application symfony/translation-contracts v2.4.0 Generic abstractions related to translation symfony/twig-bridge v5.2.6 Provides integration for Twig with various Symfony components symfony/twig-bundle v5.2.4 Provides a tight integration of Twig into the Symfony full-stack framework symfony/validator v5.2.6 Provides tools to validate values symfony/var-dumper v5.2.6 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v5.2.4 Allows exporting any serializable PHP data structure to plain PHP code symfony/web-profiler-bundle v5.2.6 Provides a development tool that gives detailed information about the execut... symfony/webpack-encore-bundle v1.11.1 Integration with your Symfony app & Webpack Encore! symfony/yaml v5.2.5 Loads and dumps YAML files theseer/tokenizer 1.2.0 A small library for converting tokenized PHP source code into XML and potent... twig/twig v3.3.0 Twig, the flexible, fast, and secure template language for PHP webmozart/assert 1.10.0 Assertions to validate method input/output with nice error messages.

Stacktrace:

Connection.php:164, SchedulerBundle\Bridge\Doctrine\Transport\Connection->create() DoctrineTransport.php:74, SchedulerBundle\Bridge\Doctrine\Transport\DoctrineTransport->create() Scheduler.php:82, SchedulerBundle\Scheduler->schedule() App_KernelDevDebugContainer.php:1274, ContainerYHAJfGA\App_KernelDevDebugContainer->getSchedulerService() getListTasksCommandService.php:23, ContainerYHAJfGA\getListTasksCommandService::do() App_KernelDevDebugContainer.php:519, ContainerYHAJfGA\App_KernelDevDebugContainer->load() Container.php:441, ContainerYHAJfGA\App_KernelDevDebugContainer->getService() ServiceLocator.php:42, Symfony\Component\DependencyInjection\Argument\ServiceLocator->get() ContainerCommandLoader.php:45, Symfony\Component\Console\CommandLoader\ContainerCommandLoader->get() Application.php:551, Symfony\Bundle\FrameworkBundle\Console\Application->has() Application.php:640, Symfony\Bundle\FrameworkBundle\Console\Application->find() Application.php:116, Symfony\Bundle\FrameworkBundle\Console\Application->find() Application.php:254, Symfony\Bundle\FrameworkBundle\Console\Application->doRun() Application.php:82, Symfony\Bundle\FrameworkBundle\Console\Application->doRun() Application.php:166, Symfony\Bundle\FrameworkBundle\Console\Application->run() console:43, {main}()

It's the following line in Bridge/Doctrine/Transport/Connection.php:164 in the create method: $this->logger->warning(sprintf('The task "%s" cannot be created as an existing one has been found', $task->getName()));

MarcelWilhelmi commented 3 years ago

My scheduler.yaml looks like this:

scheduler_bundle:
    transport:
        dsn: 'doctrine://default?execution_mode=first_in_first_out&auto_setup=true'
    tasks:
        ...

Do you need any more information?

Guikingone commented 3 years ago

Hi @MarcelWilhelmi 👋🏻

Nope, that's enough, the log call is not an error, it's a "information" about the fact that we've tried to create a task which already exist, the warning level is probably not the good one, WDYT ? 🤔

MarcelWilhelmi commented 3 years ago

I'd say it should be either an info message or no log entry should be written at all in this case. I'd log an info message when the task didn't exist and was created, because this is the exceptional case in my opinion. An already existing task is the "normal" case imho and should not create a log message on every scheduler:consume call. WDYT?

Guikingone commented 3 years ago

I agree on the fact that the log is either too high in the log chain or not useful, do you want to submit a PR to improve this?

MarcelWilhelmi commented 3 years ago

Well, I've never opened a PR on GitHub but I can try. Do you think this is necessary? I hoped you could just implement this little change for the next upcoming release.

Guikingone commented 3 years ago

I can if you prefer, I was offering you the opportunity to contribute to the bundle but it's okay for me, I'm gonna improve this 🙂

Guikingone commented 3 years ago

The extra logger call will be removed on next patch version, thanks for the issue @MarcelWilhelmi 🙂

MarcelWilhelmi commented 3 years ago

@Guikingone Thank you very much again for the fix and the opportunity to contribute to the bundle. If I stumble upon another issue I will definitely consider submitting a PR.