Code Monkey home page Code Monkey logo

commandschedulerbundle's People

Contributors

b4cedev avatar balabis avatar bghosts avatar damner avatar dlabouesse avatar drawgas avatar ekomidevops avatar fabienpapet avatar fyrye avatar gemorroj avatar genietim avatar glideh avatar gubler avatar iwfy avatar j-guyon avatar phansys avatar philetaylor avatar pierstoval avatar pwbdod avatar reyostallenberg avatar schyzophrenic avatar sctt avatar sfarkas1988 avatar spajxo avatar tikoflano avatar tis-dm-webfactory avatar tomasceruti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

commandschedulerbundle's Issues

Logging to syslog

Hello,

Is there a way to enable logging via Monolog in this bundle rather than to file? In our current system we use Monolog to log to syslog, it would be great if this bundle would support logging via Monolog too (or have an independent way of writing in syslog).

Thanks!

cron not running

when I run php app/console scheduler:execute --dump

it says
Start : Dump all scheduled command Immediately execution asked for : app:mycommand

but no log-file is generated and I think my command is not executed (I don't the any results - it should generate a file)

But when I type my command
php app/console app:mycommand
it works without any problems.

I set the log_path and even created the logFile.log which I also use as name for the output log (myFile.log).

Any help for debugging appreciated. Thanks.

Lock_timeout is not timeouting commands that run to long

In documentation we have this

# This default value disables timeout checking (see monitoring), set to a numeric value (seconds) to enable it
lock_timeout: false

If I got it right if change value of lock_timeout I would like CommandChedulerBundle to stop commands that are running at least, given time(in seconds). What is happening? Clearly nothing, I have idea that it is used to email to people when script timeouts, and then someone should manually stop it. I would like also option to automatically stop, because I'm using automatically cron-flow. Thanks

Why forcing the doctrine naming strategy ?

Is there a reason why we are specifying the column names in the mapping ?

I'm personally using Symfony's default naming strategy for Doctrine (with is lowercase underscore), and the bundle creates this only one full uppercased table.

Since we can't override the mapping, shouldn't we remove the column names so Doctrine can fallback on the configured strategy ?

Great bundle by the way !

cron not running

I have installed CommandSchedularBundle via composer. I have got the all the screens. I have created two schedulers. One for every 10 mins and the other for every 5 mins. The sehedulers runs only when I run this command php bin/console scheduler:execute

When I go to monitor page it always gives empty array [ ] which means everything ok.

Am I missing any configurations ? Or should I want to enable any PHP extensions ?

Allow Twig 2.x

It is not possible to use twig 2 with this bundle, please add |~2.0 for the twig version constraint.

Error in log_path

With the default config of the bundle ->scalarNode('log_path')->defaultValue('var\logs')->end() I want to execute php bin/console scheduler:execute and the result: var/logs\ not found or not writable. You should override log_path in your config.yml.

Is this an OS path configuration problem? When I change var\logs by var/logs it works. Maybe this default configuration is for Windows OS specifically.

I'm also facing another error. I have installed the bundle step by step just like the documentation says, then in route /command-scheduler/detail/new the form for creating a new task the fields seems to be not focusable, I can't focus any field.

Sorry for my english.

Does it work on a windows server ?

I have a project in Symfony3 and it is hosted on a Windows Server.
So, my custom command line should be executed with AT (windows) and not with CRON (unix), right ?

Does this bundle work on a windows server ?
Should I write an AT expression in the Cron expression field ??

Thank you for helping.

Refactor choice list for reusability

It would be nice to have choice list as separate field type like "commands_choice", that doing the same, without additional manipulations.
And more importantly command list generation code is not reusable, it would be good to have it as separate service, that is uncoupled from forms, so one could call it from anywhere and get commands list.

Regards.

Time for another release?

Would it be possible to release a new version? Last one is from June and a few interesting changes have been merged to master since then...
I'm in particular interested on the fix addressed by pull request #39

Thanks a lot

incompatible with FOSElasticaBundle?

I just tried to install this bundle, but got this message from Composer:

C:\mysymfonyproject-folder\ composer require jmose/command-sch
eduler-bundle
Failed loading C:\php\ext\php_xdebug-2.4.0-5.6-vc11-x86_64.dll
Using version ^1.2 for jmose/command-scheduler-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove friendsofsymfony/elastica-bundle 4.0.x-dev
- Conclusion: don't install friendsofsymfony/elastica-bundle 4.0.x-dev
- don't install friendsofsymfony/elastica-bundle 4.0.x-dev|install friendsofsymfony/elastica-bundle dev-master
- Conclusion: remove ruflin/elastica 3.1.1
- Installation request for friendsofsymfony/elastica-bundle (locked at 4.0.x-dev, required as dev-master) -> satisfi
able by friendsofsymfony/elastica-bundle[4.0.x-dev].
- Conclusion: don't install ruflin/elastica 3.1.1
- friendsofsymfony/elastica-bundle dev-master requires ruflin/elastica ~2.1 -> satisfiable by ruflin/elastica[2.1.0,
2.2.0, 2.2.1, 2.3.0, 2.3.1].
- Can only install one of: ruflin/elastica[2.1.0, 3.1.1].
- Can only install one of: ruflin/elastica[2.2.0, 3.1.1].
- Can only install one of: ruflin/elastica[2.2.1, 3.1.1].
- Can only install one of: ruflin/elastica[2.3.0, 3.1.1].
- Can only install one of: ruflin/elastica[2.3.1, 3.1.1].
- Installation request for ruflin/elastica (locked at 3.1.1) -> satisfiable by ruflin/elastica[3.1.1].

Installation failed, reverting ./composer.json to its original content.

I don't know what the issue is with the FOSElasticaBundle, i don't see why it should clash, given Doctrine is used as a primary datastore?

Entity defaults absence with required db properties casing error

Hi,

I'm using entity from personal controller and getting sql constraint violation error, because optional entity properties have no defaults and are required by db.

I think ScheduledCommand init() method violates some OOP principles, as user of class shouldn't know about internals.
Therefore I would suggest to initialize defaults from __construct()

     /**
      * Constructor
      */
     public function __construct()
     {
         $this->setLastExecution(new \DateTime);
         $this->setExecuteImmediately(false);
         $this->setDisabled(false);
         $this->setLocked(false);
     }

or remove db constraints.

I would be glad to make PR, but which way would you prefer?

Regards.

Command not execution automatically

Hi,

Iam on Ubuntu 16.04, i write in the file "/etc/crontab" this command "* * * * * php /my/path/symfony/app/console scheduler:execute" (iam on symfony 2.5) and... nothing happen.
I am on version 1.1.x for this bundle.
And anything other command in my crontab works.

thanks for help.

Monitoring is not detect if task crash with fatal exception

Hi. Thanks for your bundle, it is really useful.

But I found an issue:

If some task is crushed with fatal exception (e.g. out of memory or some function returns incrorrect type in php 7+), in this case last result will not changed and task will stay locked.

E.g. if during scheduler:execute some task is crashed:

[Symfony\Component\Debug\Exception\FatalThrowableError]
  Type error: Return value of SomeService::getUser() must be an instance of
   SomeUser, null returned

In this case the next scheduler:monitor will not show any problem.

Create log path if it does not exist

Hi,
I configured a log path in my SF2 which does not exist yet (app/logs/scheduler). How about extending the code to try to create the folder first and then check if it's writable (https://github.com/J-Mose/CommandSchedulerBundle/blob/master/Command/ExecuteCommand.php#L95).

Example:

// Before continue, we check that the output file is valid and writable (except for gaufrette)
if (false !== $this->logPath && strpos($this->logPath, 'gaufrette:') !== 0) {
	// Create folder if it does not exist yet.
	// TODO: maybe pass in folder permission and set "0744" (or s.th. else) as fallback.
	if (false === is_dir($this->logPath) && false === mkdir($this->logPath, 0744, true) {
		$output->writeln(
			'<error>Cannot create folder "'.$this->logPath.'". Please change your `log_path` in config.yml'.'</error>'
		);
		return;
	}

	if (false === is_writable($this->logPath)) {
		$output->writeln(
			'<error>'.$this->logPath.
			' not found or not writable. You should override `log_path` in your config.yml'.'</error>'
		);
		return;
	}
}

Scheduling of cache:clear is not supported properly

In documentation I can find information:

The --env= and -v (or --verbosity) arguments are passed to all scheduled command from scheduler:execute, so you don't have to put these on each scheduling !

I was going mad yesterday, when I've been testing your bundle. I used cache:clear command as example scheduled command and I wanted to clear prod environment - it's impossible! Every time scheduler:execute is run (without -e/--env, so default dev is used) and is handling scheduled cache:clear -e=prod command, it clears dev cache instead of requested one.

I was debugging it and -e parameter is properly stored in ArrayInput, but is not used (or is overriden) when command is run.

PS. I don't think forcing --verbosity from scheduler:execute is good too. What about situation, when I want one scheduled command to be on vvv level and other on v, and another without verbose option? Both options should be configurable per scheduled command.

Allow manual run of disabled tasks

In my use case, I need to allow manual run of disabled tasks.

When I click on the run button, UI says it will run on the next schedule command. But here's the command output.

$ app/console scheduler:execute
Start : Execute all scheduled command
Nothing to do.

An alternative would be to make cron expression optional.

adding task on anacrontab

hi, i trying to use your bundle for one week.

all are working perfect in SSH mode, but when i add task in anacronatb then das not work !!

i get this error :

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "scheduler:execute
" is not defined.                    
  Did you mean one of these?                                      
      scheduler:execute                                           
      scheduler:monitor   

this the command linge i deed add in anacrontab file :

@hourly 0 cron.daily-1 php -f /srv/data/web/vhosts/www.pets.me/htdocs/bin/console scheduler:execute

i dont know want to do, i m bloque.

thank

Parallel execution

Hello,

thank you for this great bundle. It looks pretty good.

I have created multiple tasks. Some tasks needs 2 hours, another one needs 4 hours and all the other tasks are done in less than a minute. I call scheduler:execute each 5 minutes as I have a task (*/5 * * * *) which has to send all mails of a queue.

At 8 o'clock one of my 2 hour task starts. While this execution all my other tasks will start AFTER my 8 o'clock task. So, I can't send mails for a timeframe of 2 hours.

How can I allow parallel execution of my tasks?

Stefan

including custom commands

Is there a way to include commands that you create by yourself in the detail.command dropdown? Currently got a command that l have personally created and wanted to add it into the cron list but it doesn't seem to appear in the dropdown.

Cron details from DB

Hi, I created my own custom command. Now, I would like to get the details of the command from the table while the cron starts executing.

Symfony 4 support?

Curently max version of symfony core is 3.*. Any chances for symfony 4 support?

Warning (fopen()) on scheduler:execute when using log_path : false

Hi,

I'm currently using the v1.2.1 version of this bundle (commit 84e86f9) and I've stumbled upon a bug when using the log_path: false configuration option in config.yml. I want to disable all logging so I'm using this option as per the documentation. The problem is that when this option is set and I run the scheduler:execute command I get the following warning:

  [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: fopen(): Filename cannot be empty

The problem lies on this line:

        // Use a StreamOutput or NullOutput to redirect write() and writeln() in a log file
        if (false === $this->logPath && "" != $scheduledCommand->getLogFile()) {
            $logOutput = new NullOutput();
        }else{
            $logOutput = new StreamOutput(fopen(
                $this->logPath . $scheduledCommand->getLogFile(), 'a', false
            ),$this->commandsVerbosity );
        }

The first conditional is wrong, because when $this->logPath is false and $scheduledCommand->getLogFile() is empty (I haven't configured any log file name when creating my scheduled command) it creates an StreamOutput pointing to an empty file (hence the fopen() error) instead of using the NullOutput. I think this should be changed to:

        // Use a StreamOutput or NullOutput to redirect write() and writeln() in a log file
        if (false !== $this->logPath && "" != $scheduledCommand->getLogFile()) {
            $logOutput = new StreamOutput(fopen(
                $this->logPath . $scheduledCommand->getLogFile(), 'a', false
            ),$this->commandsVerbosity );
        }else{
            $logOutput = new NullOutput();
        }

This will create an StreamOutput only if there is a proper (non false) logPath defined and the Log file name is not empty (if it's empty we can assume there is no interest in logging the output so we can disable logging for individual commands). If logPath is false or the log file name is empty we'll just use NullOutput.

Please let me know what you think (I can create a pull request with the proposed fix if you want).

Cheers,
Mikel.

Fill for missed jobs

For example, if a command suppose to run each minute, but the scheduler:execute command was not executed by 5 minutes, when resuming the work it should schedule 5 jobs instead of just one, this way it will "fill the gap" of jobs that were supposed to be done.

Sorry for my english,
thank you !

Cannot schedule commands that use Symfony arguments instead of Options

Commands that have been written to accept arguments cannot be run by scheduler. Every "argument" as refered to by the "Arguments" field in the command building form must actually be a Symfony "InputOption". I would like to be able to schedule commands that have required arguments so they do not need to be optional arguments when in fact they are required.

Lock table not secure!

Hey, first time that i run into a big issue with your bundle on a production environment! :(
The locking strategy does not work properly. It locks the current running command only for not getting the same command again when executing scheduler:execute in parallel.
I hope my screenshot explains it better:

The point is: When a command takes longer than the time you execute scheduler:execute again, all not runned commands will getting recognized as not executed and not locked again!
Depending on how long your commands will take and how often you execute scheduler:execute as often upcoming commands will be executed in parallel.

Please add a big comment on top of your README file so everyone is aware of this problem when using it in production mode!

I try to provide a solution for it.

Command not execution automatically

Hello all, i don't know what i am doing wrong, but my commands do not execute automatically after the given time i gave while creating the task. it only executes when a launch php bin/console scheduler:execute --env=env -vvv in console.

Regards.

Create unit tests

Create unit test and connect Travis CI

Todo list :

  • ListController
  • DetailController
  • Configuration and extension
  • FormType compilation
  • Validation and CronExpression validator)
  • Command SchedulerExecute test

My task stay locked

Hi,

I wanted to know why one of my tasks stay locked after have been executed normaly ?

Override/estends template.

Hi im want to know if you plan to give possibility to override template so it can be possible to extends in twig, to have the possibility to "include" the main style.

Thank

Exceptions are caught in the scheduler, so I can't handle them myself

Great bundle btw.

My only issue is, I have an exception listener set up to email me console command exceptions. This works fine when I run a command directly, but when it runs through the scheduler the exception is caught, so the listener can't respond to the uncaught exception and I can't be alerted.

Ideally I would rather the exception from a scheduled command not be caught so I could handle it however I want, not sure if that's possible, or some other way I could achieve this?

Cheers.

Locale for other languages

Hi,

I have an app with locale 'es'. Currently the command scheduler pages show titles like "detail.name" or "list.title". Aparently when the locale doesnt match 'en' or 'fr', it doesn't load any of the languages file in your bundle. Could you correct this so that by default it is english (in case a different locale is set in the config) ?
If you could also add the 'es' locale I would really apreciate it. I already made them following the format in your bundle, so I attach them in case you need them.

Thank you

validators.es.xlf.txt
JMoseCommandScheduler.es.xlf.txt

Default value for log_path

What about changing the default value of log_path configuration property from /var/logs to "%kernel.logs_dir%" ?

doctrine needs to be reconnected after a long running task

Hi,
I have a problem tasks finishing with a successfull return code, but not being unlocked, so I found out that since the Doctrine connection is not used during the long task, it times out, and I have to reconnect it, before exiting the task.
Maybe this could be handled by the bundle - checking if the connection is still active, and reconnecting if not?
Thanks! :)

Deprecated Auto-registration Command

I have this depretions in Symfony 3.4.

User Deprecated: Auto-registration of the command "Symfony\Bundle\SwiftmailerBundle\Command\DebugCommand" is deprecated since Symfony 3.4 and won't be supported in 4.0. Use PSR-4 based service discovery instead.

D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Bundle\Bundle.php:190
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:153
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:92
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:229
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:72
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:148
D:\wamp\www\My\vendor\jmose\command-scheduler-bundle\Service\CommandParser.php:56
D:\wamp\www\My\vendor\jmose\command-scheduler-undle\Form\Type\CommandChoiceType.php:39
D:\wamp\www\My\vendor\symfony\symfony\src\Symfony\Component\Form\ResolvedFormType.php:192
.....

Thanks,

Paulo

Change ScheduledCommand entity to mapped super class

Hi,
really nice bundle, thank you for your work. :)

In my project I want to extend repository class, which is not possible due doctrine mappings is not overridable via bundle override. One way to solve it would be to change entity type to mapped super class, like fos user bundle is working.

On separate note, take a look at http://docs.sylius.org/en/latest/bundles/SyliusResourceBundle/ which is very much suited for your cause and could drastically improve extendability (everything become a service and one could override repo by just replacing FQCN), add some features like different managers almost for free.

Example of how repo would be overridden in case of sylius resource bundle http://docs.sylius.org/en/latest/bundles/general/overriding_repositories.html

Let me know if I could assist you with this.

Regards.

New scheduler - no label for checkboxes

in command-scheduler/detail/new, there is no label for the 2 checkboxes at the end of the page:

  • executeImmediately
  • disabled

solution :
replace
{{ form_widget( scheduledCommandForm.disabled ) }}
{{ form_label( scheduledCommandForm.disabled ) }}

by
{{ form_row( scheduledCommandForm.disabled ) }}

in views/Detail/index.html.twig

Custom Command with dependency injection

Hi,
i have created a custom command and it is correctly listed in command list to be executed. When i try to add a dependecy injection like
`
public function __construct(CustomRepository $repo)
{

    $this->repo = $repo;

    parent::__construct();
}

`

command disappear from list and i'm not able to schedule it. Why? Thanks, best regards

Scheduler couldn't write logs

Hi, I have given log_path in the configuration file. But I am getting below error.

php.INFO: Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.
Is there a fix for this ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.