Code Monkey home page Code Monkey logo

cake-resque's People

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  avatar  avatar  avatar  avatar  avatar

cake-resque's Issues

Monolog: timezone setting missing

Hi,

since there's no possibility to open an issue directly at the monolog-repo, I'd like to open up the issue here, because i do receive the error when firing up a resque worker.

by calling

Console/cake CakeResque.CakeResque start

I receive a "fail" and the worker can not be started. having a look in the resque-worker-error.log I found the following error:

PHP Fatal error:  Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead' in …/htdocs/app/Plugin/CakeResque/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php:42
Stack trace:
#0 …/htdocs/app/Plugin/CakeResque/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(42): DateTime->__construct('tomorrow')
#1 [internal function]: Monolog\Handler\RotatingFileHandler->__construct('/Users/...')
#2 …/htdocs/app/Plugin/CakeResque/vendor/kamisama/monolog-init/src/MonologInit/MonologInit.php(98): ReflectionClass->newInstanceArgs(Array)
#3 [int in …/htdocs/app/Plugin/CakeResque/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php on line 42

Of course, I sat the date_default_timezone_set directly within Cake's core.php file, but this is apparently not reflected by monolog.

by adding the "date_default_timezone_set('Europe/Vienna');" directly to the mentioned file above, everything works as expected. but I think, this is only a quick & dirty hack - not a proper solution to the underlying problem. what do you think?

Could not open input file: ./bin/resque.php

Hi,
i've installed all and queued two jobs.

Starting Worker

./cake CakeResque.CakeResque start
Creating workers
Starting worker ..................... Fail

Reading resque-worker-error.log in cake tmp read:

"bash: php: command not found"

This is stats

[root@server Console]# ./cake CakeResque.CakeResque stats
Resque Statistics
---------------------------------------------------------------
Jobs Stats
   Processed Jobs :            0
   Failed Jobs    :            0
Queues Stats
   Queues count : 2
    - default    :            1 pending job (unmonitored queue)
    - Graph      :            1 pending job (unmonitored queue)
Workers Stats
   Workers count : 0

and this is ShellClass

<?php
/**
 * CakePHP q_GraphShell
 * @author zenomordiante
 */
App::uses('AppShell', 'Console/Command');

class ResqueGraphShell extends AppShell {

    public $uses = array('Members.User', 'Graph');
    public $task = array();

    public function main() {

    }

    //$target_id, $notify_text, $notify_url, $plugin_name
    public function notify(){
        $this->log('ciao!', 'resque');
    }
}

I've also changed some path in CakeResque/Lib/CakeResqueBootstrap.php to reflect my app setting folder
What happened?

Support Scheduled Jobs

I've been using this framework for my Cake project and it works well!

However I'm really missing a feature some other systems resque systems have which is job scheduling.

For example, I would like to send newsletter emails using a job, so I've generated 50 jobs for 50 emails that are sent out. However I want to schedule these to get sent out at midnight.

Are you able to implement this into the code? Perhaps it's just an extra parameter to enqueue. The job has a time saved with it and the worker just checks to see if the time has passed, if not it leaves the job alone and checks the next job.

Proper redis host/port not always passed

In the shell, whenever you call

    $workersCountBefore = Resque::Redis()->scard('workers');

That does not set a port or anything for the Redis class. So then it tries to connect to null which fails.

    Warning Error: Redis::pconnect(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in [/Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Redis.php, line 22]

    Error: Redis server went away
    #0 /Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Redis.php(23): Redis->setOption(2, 'resque:')
    #1 /Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Redis.php(17): RedisApi->establishConnection()
    #2 /Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque.php(97): RedisApi->__construct('', '')
    #3 /Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/Console/Command/CakeResqueShell.php(237): Resque::redis()
    #4 /Users/jose/Sites/work/michaelli.phpfogapp.com/lib/Cake/Console/Shell.php(390): CakeResqueShell->start()
    #5 /Users/jose/Sites/work/michaelli.phpfogapp.com/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand('start', Array)
    #6 /Users/jose/Sites/work/michaelli.phpfogapp.com/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
    #7 /Users/jose/Sites/work/michaelli.phpfogapp.com/app/Console/cake.php(33): ShellDispatcher::run(Array)
    #8 {main}

Duplicate shell param (-q).

I'm adding documentation to console sub commands and missing options (not positional params) to the missing sub commands from CakeResqueShel; be enqueue, enqueueIn, enqueueAt, and as start, they accept a queue but when I was adding that I noticed the short param -q is used by Shell to enable quiet output.

./Console/cake CakeResque.CakeResque
--quiet, -q    Enable quiet output.
./Console/cake CakeResque.CakeResque start -h
--quiet, -q               Enable quiet output.
--queue, -q               Name of the queue. If multiple queues, separe
                          with comma.

Would you mind if I change the -q param to something else? If yes, what would you like it to be?¿

Composer.phar installation breaks all the things

If I already have a deploy strategy that does not involve composer - like git subtrees or git submodules - then your alternative method breaks all the things for me.

Composer is great and all, but honest you should also allow me to store my dependencies however I want.

Do not include config.php in repository

Configuration files are likely to be customized, but since Config/config.php is part of the repository it is overwritten at every "php composer.phar update" run. Wouldn't it be better to provide a config.default.php and let this be copied to config.php at install time? Also, then add Config/config.php to .gitignore so git will not complain about it being there.

Uppercase 'kill' prevents stopping/restarting workers

Simple fix is to change app/Plugin/Resque/Console/Command/ResqueShell.php around line 206:

-exec('Kill -9 '.$pid); // Kill all remaining system process
+exec('kill -9 '.$pid); // Kill all remaining system process

Strict Error: variables passed by reference in CakeResqueShell.php, line 846

In the console, when I create a worker and then use CakeResque stats I get the following error:

Strict Error: Only variables should be passed by reference in [/opt/lampp/htdocs/buscaparking/Plugin/CakeResque/Console/Command/CakeResqueShell.php, line 846]

Issue is solved changing this:

foreach ($workers as $worker) {
    $activeQueues = array_merge($activeQueues, explode(',', array_pop(explode(':', $worker))));
}

to this:

foreach ($workers as $worker) {
    $workerParams = explode(':', $worker);
    $activeQueues = array_merge($activeQueues, explode(',', array_pop($workerParams)));
}

Thank you =)

Restart resque workers on deployment

Hi,

I've got a staging and production site, both on the same server. They use CakeResque. I'm using Capistrano for deployment. I've got a capistrano task that executes each deployment, to stop / start all resque workers:

  # Stop all first. If we instead use restart, for some reason
  # it creates one extra worker each deploy.
  # ie, after 10 deploys, there'll be 10 workers
  desc "Re-Start CakeResque Workers"
  task :restart_resque_workers, :roles => :app do
    run "#{latest_release}/app/Console/cake CakeResque.CakeResque stop -a"
    run "#{latest_release}/app/Console/cake CakeResque.CakeResque start"
  end

The deployment works, and the terminal output shows that Resque appeared to start a worker correctly. However, that worker won't pick up any jobs allocated to it.

After deployment, if I manually execute eg.

cap staging deploy:restart_resque_workers

that is, if I just restart the workers and don't do a full deployment, then it all works OK, and the worker will pick up jobs.

Except that if I restart the workers via the staging path:

cap staging deploy:restart_resque_workers

then the production site's workers no longer pick up jobs. And likewise, if I restart the production workers, they'll pick up jobs, but the staging site's workers will stop picking up jobs.

Any idea what's going on? Should the staging / production sites, and their workers, be able to run site-by-side on the same server without interrupting one another?

And any idea why restarting as part of the normal capistrano process appears to work, but the workers don't pick up jobs?

Thanks for any help, and thanks for a great plugin!

Requiring sudo by default leads to problems on default linux systems (eg debian)

In CakeResqueShell:

 sprintf("nohup sudo -u %s \\\n", $this->_runtime['user']),

Calling sudo - even to sudo as one-self - requires to be part of a /etc/sudoers list.

Most users which are made to run tasks aren't in that list.

Suggested change: If the target user is the same user as the one who runs the shell. Don't use sudo.

If you find this issue through google:
A workaround for this problem is to run this as root

chmod u+w /etc/sudoers
echo "YOUR_TASK_USER ALL=(YOUR_TASK_USER) NOPASSWD: ALL" >> /etc/sudoers
chmod u-w /etc/sudoers

Version bump please

Can we get a version bump to 4.0.3 please? It would be nice to be able to get the latest several commits without having to use dev-master with composer.

Starting worker logs error Cannot redeclare composerRequire...

Starting worker fails and this error is being logged in resque-worker-error:

Fatal error: Cannot redeclare composerRequire1ffb0fd74e42d319f0dc6067468206a9() (previously declared in /Users/brian/Development/cakephp_example/app/Vendor/composer/autoload_real.php:47) in /Users/brian/development/cakephp_example/app/Vendor/composer/autoload_real.php on line 50

How to remove a job after scheduling

Hello,
I'm using scheduler for running some tasks. But sometimes I want to delete some jobs which are scheduled.

I'm doing this way but it didn't work.
ResqueScheduler.php

public static function delayedPush($timestamp, $item)
    {
        $timestamp = self::getTimestamp($timestamp);
        $redis = \Resque::redis();

        ### My modification
        // Custom key
        $key = 'task_run_on_sunday_#1';
        $value = 'resque:_schdlr_:1417599060'; // I found this key has job detail
        // I add a custom key in redis
        $redis->hset("job_scheduled_store", $key, $value);

        $redis->rpush(self::QUEUE_NAME . ':' . $timestamp, json_encode($item));
        $redis->zadd(self::QUEUE_NAME, $timestamp, $timestamp);
    }

And If I want to delete task task_run_on_sunday_#1 from scheduler:
I delete that key resque:_schdlr_:1417599060 and delete 1417599060 from resque:_schdlr_.

Could anyone help me to resolve this?

Scheduler Error

in this repository, it has use the php-resque-ex.
But it will meet a error while using Scheduler.

Error From:
php-resque-ex Redisent line 73 the $args in this line is not quite structured. Error occur when use redis command ZRANGEBYSCORE .

The $args should be flatten to generate a proper redis protocol command.

second execution of worker not load models correctly

Hi,
first of all, sorry for my english and thank you for this wonderful plugin.
I have this issue:
In a worker, the first execution go ok, the second execution instead breaks:

I receive this warning when I do a find('all') with callbacks set to true:

all_user_func_array() expects parameter 1 to be a valid callback, class 'JsonableBehavior' does not have a method '1' in [...../vendor/cakephp/cakephp/lib/Cake/Utility/ObjectCollection.php.

And in the daily log this info:

IGPIPE received; attempting to reconnect.

thank you in advance.

Leonardo.

Path to shell method

Hello,

The path to call my method in the shell file is in the core path ? not in my app.
I change this path in the method createJob but i always the problem.
My CAKE_CORE_INCLUDE_PATH is lib/version/2.2/Cake is it a error ?

Thank you

default install by composer not git submodule

Now the default install way of this plugin is by "git submodule" as the document say.
But nowadays, more and more developers manage their app's plugins by composer.json.
Off course, it's possible to manage this plugin by composer.json, if we want.
But in that case, we have to set paths of this plugin's dependencies in app's config, because thoese dependencies is installed in app's Vendor directory, not CakeResque's Vendor directory.
I think that's tricky somehow.
It's easier that all we have to do is run "composer require kamisama/cake-resque".

About path of Shell

Hi kamisama, I have problem when i created jobs. When i create jobs and run shell, it cannot get correct path of shell. I checked code and i saw this row
if (self::$rootFolder === null) {
self::$rootFolder = dirname(dirname(dirname(DIR))) . DS;
}
$classpath = self::$rootFolder . (empty($plugin) ? '' : 'Plugin' . DS . $plugin . DS) . 'Console' . DS . 'Command' . DS . $model . '.php';

-it means , if we don't set rootFolder , the path always set is command shell in plugin. So if we have many applications on one domain
Ex structure: app,
app_1,
app_2
plugins/CakeResques

Could you tell me how can i set rootFolder or solution set correct path. Thanks you.

CakeResque in Heroku

I'm trying to use CakeResque to make some background process in my application.

I got run in my local server and now i'm trying to run at Hekoku.
I added the addon Redis Cloud and put the connection variables in my config but doesn't work!

Could help me with this issue?There is a way to do this?

Thanks a lot

Includes fails with custom app name

Hi,

I'm using several projects with the same cake lib base. So each of them are not called 'app', but the resque job try to include '/app/Config/database.php' and fails because the file is not stored here ....

any solution ?

Im working with the last version (3.3.8)

Strict Error: Only variables should be passed by reference in

Strict Error: Only variables should be passed by reference in [/Users/jose/Sites/work/michaelli.phpfogapp.com/app/Plugin/CakeResque/Console/Command/CakeResqueShell.php, line 465]

Sad panda. Should be:

    $output = array();
    exec('id ' . $this->_runtime['user'] . ' 2>&1', $output, $status);

Thanks!

Only use DEBUG_BACKTRACE_IGNORE_ARGS for PHP_VERSION >= 5.3.6

When I enable debug (using PHP 5.3.3 on CentOS) I get:

Use of undefined constant DEBUG_BACKTRACE_IGNORE_ARGS - assumed 'DEBUG_BACKTRACE_IGNORE_ARGS' [APP/Plugin/CakeResque/Lib/CakeResque.php, line 144]

I believe this flag was introduced in PHP 5.3.6, so please only use it when appropriate.

Avoid call_user_func_array() calls.

Is there a reason for doing this:

$result = call_user_func_array(
  self::$cakeResque . '::enqueue',
array($this->args[0], $this->args[1], explode(',', $this->args[2]))
);

instead of:

$result = cakeResque::enqueue($this->args[0], $this->args[1], explode(',', $this->args[2]));

CakeReque isn't working with tasks in Shell #2158

step 1

<?php 
App::uses('AppShell', 'Console/Command');

class NtfShell extends AppShell {

    public $tasks = array('Apns');

    public function test() {
            $this->Apns->test();
    };

step 2

   CakeResque::enqueue(
        'default', 'NtfShell', array('test')
   );

result

Fatal error: Call to a member function test() on a non-object in ....

[DEPLOYMENT] Starting workers via ssh or php hangs shell

Trying to start workers from other processes hangs the shell:

$ php -r 'passthru("Console/cake CakeResque.CakeResque start --queue test; echo foo");'
Creating workers
Starting worker ... Done

foo
^C

What's happening here is that the shell is never returned to the user, although executing Console/cake CakeResque.CakeResque start --queue test does.

Another observation is that there is actually another command in my test which gets executed (echo foo) -> but the whole command, executed in a subshell through php, never returns.

This is the most simplified case I came up with; the higher goal is automating of deployment via e.g. ssh and phing. I have both setups already running, but all hang when starting workers.

I looked at CakeResque and saw quite some sophisticated usage of subshells, nohup, pcntl; but it doesn't dawn me what could lead to the hang.

I tried strace but it floods my screen and I'm unable to pinpoint anything obvious:

$ strace -f php -r 'passthru("Console/cake CakeResque.CakeResque start --queue test");'
... snipped thousands of lines
[pid 28293] rt_sigprocmask(SIG_SETMASK, 0x7fffed271030, NULL, 8) = 0
[pid 28293] nanosleep({...}, ^CProcess 28276 detached

I was able to reproduce this behaviour in three environments: one VM, two physical machines (two Ubuntu (precise and trusty) and Debian (squeeze). I tested this with cake-resque 4.1.0 in environments with php 5.4 and 5.5 .

I tested using other means of starting them, e.g. via ruby: this works locally but also hangs when executed via ssh: ruby -e 'system("Console/cake CakeResque.CakeResque start --queue test")'.

I could work around this by starting them in the background, but I need to see the output and verify they properly started.

I've never seen such a behaviour before, any pointers/hints much appreciated.

Adding username/password to Redis setup.

I'm looking to connect my cake app with cake-resque on Heroku, but can't seem to add the parameters into my custom cake-resque config for connecting to the Redis-to-go addon with Heroku. It requires a username and password to connect to the Redis service.

Any help would be appreciated!

Improved AppShell::perform()

The documentation page for installation suggests that you add this function to your AppShell:

public function perform() {
    $this->initialize();
    $this->{array_shift($this->args)}();
}

I found that this function did not allow me to schedule jobs with commands that used non-positional options. Instead, I use:

public function perform()
{
    $this->initialize();
    return $this->runCommand($this->args[0], $this->args);
}

This way, options are parsed from the argument list in the same way that the Cake ShellDispatcher does.

Thanks!

How to dequeue a job?!

Hi..

Is there any method to dequeue a certain job id from scheduler queue ? If there's no method to satisfy this need I'm ready to add this method and create a pull request for that..

Regards,
Mostafa Amiri

Shell and started workers don't use configured server

Fix Shell configuration handling with changes to app/Plugin/Resque/Console/Command/ResqueShell.php around line 19:

// Get CakeResque plugin configuration and set backend settings
$resqueSettings = Configure::read('Resque');

$redisHost = $resqueSettings['Redis']['host'];
$redisPort = $resqueSettings['Redis']['port'];

Resque::setBackend($redisHost . ':' . $redisPort);
// End CakeResque plugin configuration handling

Fix PHP-Resque configuration handling with changes to app/Plugin/Resque/Lib/ResqueBootstrap.php around line 54:

// Get Redis config from plugin configuration and set environment variable for PHP-Resque
$resqueSettings = Configure::read('Resque');

$redisHost = $resqueSettings['Redis']['host'];
$redisPort = $resqueSettings['Redis']['port'];

putenv('REDIS_BACKEND=' . $redisHost . ':' . $redisPort);
// End Redis environment variable config

Class AppShell Not found

All my jobs are failing
Jobs Stats
Processed Jobs : 13
Failed Jobs : 13

This is my log file:
PHP Fatal error: Class 'AppShell' not found in /var/www/onlineplatform/app/Console/Command/EmailSenderShell.php on line 5

Fatal error: Class 'AppShell' not found in /var/www/onlineplatform/app/Console/Command/EmailSenderShell.php on line 5
�[31;4mFatal Error Error:�[0m Class 'AppShell' not found in [/var/www/onlineplatform/app/Console/Command/EmailSenderShell.php, line 5]

PHP Fatal error: Class 'AppShell' not found

CakePHP 2.6.1, PHP 5.5.9, Ubuntu 14, cake-resque installed via composer: "kamisama/cake-resque": "4.1.*"

I'm following the tutorial at http://cakeresque.kamisama.me/usecases#sending-emails almost exactly, but receiving the following (abbreviated) error in resque-worker-error.log:
PHP Fatal error: Class 'AppShell' not found in [...]/app/Console/Command/EmailQueueWorkerShell.php on line 4

Here are the first 4 lines of EmailQueueWorkerShell.php:

<?php
App::uses('CakeEmail', 'Network/Email');

class EmailQueueWorkerShell extends AppShell {

The worker was started with Console/cake CakeResque.CakeResque start --queue email

Here's the queue code, from within an event listener: CakeResque::enqueue('email', 'EmailQueueWorkerShell', array('sendEmail', $config)); where $config is an Array.

I do have an AppShell in my project's Command directory, with the perform() method added per the tutorial. AppShell is otherwise empty. I also have other shells extending AppShell which I can run without issue.

Can't kill workers

CakePHP 2.4.3.
Everytime I do a ./cake CakeResque.CakeResque restart, the workers won't kill and the total amount increases.

user@domain:~/path/public_html/app/Console$ ./cake CakeResque.CakeResque restart
Notice Error: unserialize(): Error at offset 0 of 5 bytes in [/home/user/path/public_html/app/Plugin/CakeResque/vendor/kamisama/resque-status/src/ResqueStatus/ResqueStatus.php, line 127]

Notice Error: unserialize(): Error at offset 0 of 5 bytes in [/home/user/path/public_html/app/Plugin/CakeResque/vendor/kamisama/resque-status/src/ResqueStatus/ResqueStatus.php, line 127]

Notice Error: unserialize(): Error at offset 0 of 5 bytes in [/home/user/path/public_html/app/Plugin/CakeResque/vendor/kamisama/resque-status/src/ResqueStatus/ResqueStatus.php, line 127]

Stopping workers
Stopping 29206 ... Done
Stopping 29133 ... Done
Stopping 17320 ... Done

Restarting workers
Starting worker ... Done
Starting worker ... Done
Starting worker ... Done
Starting worker ... Done
Starting worker ... Done
Starting worker ... Done

user@domain:~/path/public_html/app/Console$

Roadmap for Cake3

Hi Kamisama,

Thank you for this very well working plugin.. I wanna just know if there's any roadmap for Cake3 compatibility and how can we help on that?

Regards,

Starting / Stopping workers when using Capistrano

I'm using Capistrano v3 for deployment, along with Cake-Resque.

Resque is not correctly finding existing workers. For example, see the below terminal output (note the ps ux shows that a resque worker is running, but the stats indicate none exist):

staging@sabre740:~/public_html/current/app/Console$ ps ux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
staging   5879  0.0  0.0  10772  1400 ?        S    12:51   0:00 bash -c cd '/home/staging/public_html/releases/20141014015143/app/Vendor/kamisama/php-resque-ex';     VERBOSE=true  QUEUE='defaul
staging   5880  0.0  0.7 161236 15348 ?        S    12:51   0:00 php ./bin/resque
staging   6513  0.0  0.0  16836  1256 pts/6    R+   12:55   0:00 ps ux
staging  16485  0.0  0.0  73312  1660 ?        S    11:07   0:00 sshd: staging@pts/6
staging  16486  0.0  0.1  20688  3600 pts/6    Ss   11:07   0:00 -bash
staging@sabre740:~/public_html/current/app/Console$
staging@sabre740:~/public_html/current/app/Console$
staging@sabre740:~/public_html/current/app/Console$ /home/staging/public_html/releases/20141014015143/app/Console/cake CakeResque.CakeResque stats


Resque Statistics
---------------------------------------------------------------


Jobs Stats
   Processed Jobs :            0
   Failed Jobs    :            0


Queues Stats
   Queues count : 0


Workers Stats
   Workers count : 0


staging@sabre740:~/public_html/current/app/Console$

This is meaning that each time I deploy a new release, resque won't stop old workers, but it will start a new one. So I end up with an increasing number of workers hanging around, and each worker is associated with a different one of Capistrano's release paths. This is causing various issues and sometimes causing white screen of death in my app, because when an old worker runs from an old release, Cake will still cache file paths from the old release and you get a situation where Cake is trying to run with some files from the current release, and some files from previous releases.

Recommendations for process monitoring/auto-restart ?

Sorry to bother with an issue, but Google keeps me hanging on this.

Do you have any recommendation which process monitoring tool we should use to make sure the watchers are always running/restarted?

If you could also provide an example configuration this would be even better.

How does deploy CakeResque to remote server?

Hi.
We deployed CakeResque via Capistrano on trial.
via Capistrano, I execute restart command success, but actually CakeResques is not started.
via SSH, I executed restart command failed...

-- version --

PHP 5.3.19
CakeResque v3.3.1

Is gh-pages branch outdated ?

I would like to contribute to french translation but, after forking and checking out this gh-pages branch, it seems to be outdated from the gh-pages located here http://cakeresque.kamisama.me.

capture decran 2014-06-28 a 11 25 52
capture decran 2014-06-28 a 11 26 14

Can you update the gh-pages branch to the latest version ?

Thanks 😉

All my queued jobs fail

Hello, I would like to ask for something related to your CakeResque plugin.

Problem Summary:
All my queued jobs fail.

Problem Description:
I've downloaded the plugin and got it installed in my Cake project.

I was able to initialize it through the console with:

sudo Console/cake CakeResque.CakeResque start

I've ran some functions from the console, such as:

sudo Console/cake EmailSender testShell

The code for that would be:

class EmailSenderShell extends AppShell
{
    public function testShell() {

        $name = 'test_shell.txt' ;
        $file = fopen( $name, "w+" ) ;
        fwrite( $file, 'test' ) ;
        fclose( $file ) ;

    }

And that also works.
The problem is when I add a job to the queue for the worker to run them.

CakeResque::enqueue(
        'test',
        'EmailSenderShell',
        array('testShell')
    );

It returns the following:

Resque Statistics
---------------------------------------------------------------


Jobs Stats
   Processed Jobs :           53
   Failed Jobs    :           53


Queues Stats
   Queues count : 3
  - default         :            0 pending jobs
  - Email           :            0 pending jobs
  - test            :            0 pending jobs


Workers Stats
   Workers count : 3
  REGULAR WORKERS
  * david-netbook:8772:Email
     - Started on     : mié ene 08 17:23:14 ART 2014
     - Processed Jobs : 1
     - Failed Jobs    : 1
  * david-netbook:8677:default
     - Started on     : mié ene 08 17:06:58 ART 2014
     - Processed Jobs : 0
     - Failed Jobs    : 0
  * david-netbook:8846:test
     - Started on     : mié ene 08 17:25:10 ART 2014
     - Processed Jobs : 9
     - Failed Jobs    : 9

Error/Debug-Log problems

Hi @Kamisama!

Thx for your nice work - we're having the CakeResque in production since couple of months now and love the way how our app is now possible to scale again :)

Unfortunately, we do have a problem with missing errors/warnings!

In the Main-CakePHP App we define the following in core.php:

App::uses('SentryErrorHandler', 'Sentry.Lib');

Configure::write('Sentry', array(
  'production_only' => true, // true is default value -> no error in sentry when debug
  'PHP' => array(
    'server' => 'https://XXX:[email protected]/ZZ'
  )
));

Configure::write('Error', array(
  'handler' => 'SentryErrorHandler::handleError',
  'level' => E_ALL & ~E_DEPRECATED,
  'trace' => true
));

as well as

  Configure::write('Exception', array(
    'handler' => 'SentryErrorHandler::handleException',
    'renderer' => 'ExceptionRenderer',
    'log' => true
  ));

All errors/warnings within our app are therefore forwarded to getsentry (a saas-error-logging service).

Unfortunately, all errors/warnings, which occur directly within a Shell/Worker-Process, are only written to debug/error.log on disc, but not forwared to sentry.

Do you know, if we need to set the error/exception-handler again in the CakeResque Plugin/Worker-Setup?

(for sentry, we're using this excellent CakePHP Plugin: https://github.com/Sandreu/cake-sentry)

PHP Fatal error: Could not locate CakePHP core files

In CakeResqueBootstrap.php I had to change $dispatcher to this value :
$dispatcher = '../CakePHP/Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';

Because it was throwing an error "PHP Fatal error: Could not locate CakePHP core files".

I installed CakePHP using composer.

Configuration for custom routes

Hi.
I have separated folders for my app and cake core, working with a modified path in webroot/index.php.
The structure is

  • htdocs
    • myapp
    • cake

When I tried to run CakeResque I had a issue with the include path (workers failed to create). I fixed it making a symlink from htdocs to cake/lib/ to avoid changing CakeResqueBootstrap.php. Workers now work fine, but when I try to enqueue a Job it always fails (Both console and code). Looking at the log file found this error:

[mydate] main.ERROR: {"queue":"default","id":"340fe4379d2f260509884ff517cc03b4","class":"myShell","args":[["funcion"]]} failed: Plugin CakeResque could not be found. {"type":"fail","log":"Plugin CakeResque could not be found.","job_id":"340fe4379d2f260509884ff517cc03b4","time":12,"worker":"mypc:20873"} []

I've tried searching for that error string to see where it's failing, but I couldn't find it.
It's possible to configure the plugin so it can work with a custom folder structure?, if so, is in the docs? I've searched for this and couldn't find anything.
Where in the plugin is trown this error?

Thanks for your time.

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.