Closed DdCooper closed 10 years ago
You seem to be manipulating a file. Are you running the worker under the right user, to avoid permission issues ?
What does the log saying ?
This is my log and I'm running the command like super user
Tailing /home/david/izus/dev/apps/gama-app/tmp/logs/resque-2014-01-08.log [2014-01-08 17:25:11] main.INFO: got {"queue":"test","id":"8f1b7ae5d17f82857eba08de2b8ebc5f","class":"EmailSenderShell","args":[["testShell"]]} {"type":"got","args":"[object](Resque_Job: {"queue":"test","worker":null,"payload":{"class":"EmailSenderShell","args":[["testShell"]],"id":"8f1b7ae5d17f82857eba08de2b8ebc5f"}})","worker":"david-netbook:8846"} [] [2014-01-08 17:25:11] main.INFO: Processing ID:8f1b7ae5d17f82857eba08de2b8ebc5f in test {"type":"process","worker":"david-netbook:8846","job_id":"8f1b7ae5d17f82857eba08de2b8ebc5f"} [] [2014-01-08 17:25:11] main.INFO: got {"queue":"test","id":"4dbbd04b805be7725958512f374e4d3a","class":"EmailSenderShell","args":[["testShell"]]} {"type":"got","args":"[object](Resque_Job: {"queue":"test","worker":null,"payload":{"class":"EmailSenderShell","args":[["testShell"]],"id":"4dbbd04b805be7725958512f374e4d3a"}})","worker":"david-netbook:8846"} [] [2014-01-08 17:25:11] main.INFO: Processing ID:4dbbd04b805be7725958512f374e4d3a in test {"type":"process","worker":"david-netbook:8846","job_id":"4dbbd04b805be7725958512f374e4d3a"} [] [2014-01-08 17:25:11] main.INFO: got {"queue":"test","id":"699c5a17e766fffc58c56b4ca9f77826","class":"EmailSenderShell","args":[["testShell"]]} {"type":"got","args":"[object](Resque_Job: {"queue":"test","worker":null,"payload":{"class":"EmailSenderShell","args":[["testShell"]],"id":"699c5a17e766fffc58c56b4ca9f77826"}})","worker":"david-netbook:8846"} [] [2014-01-08 17:25:11] main.INFO: Processing ID:699c5a17e766fffc58c56b4ca9f77826 in test {"type":"process","worker":"david-netbook:8846","job_id":"699c5a17e766fffc58c56b4ca9f77826"} [] [2014-01-08 17:25:11] main.INFO: got {"queue":"test","id":"9be6c8e7a52b0c2adc183ddb2a73065a","class":"EmailSenderShell","args":[["testShell"]]} {"type":"got","args":"[object](Resque_Job: {"queue":"test","worker":null,"payload":{"class":"EmailSenderShell","args":[["testShell"]],"id":"9be6c8e7a52b0c2adc183ddb2a73065a"}})","worker":"david-netbook:8846"} [] [2014-01-08 17:25:11] main.INFO: Processing ID:9be6c8e7a52b0c2adc183ddb2a73065a in test {"type":"process","worker":"david-netbook:8846","job_id":"9be6c8e7a52b0c2adc183ddb2a73065a"} [] [2014-01-08 17:26:11] main.INFO: got {"queue":"test","id":"8a99e7bd37ffdf573a9e514dfe719571","class":"EmailSenderShell","args":[["testShell"]]} {"type":"got","args":"[object](Resque_Job: {"queue":"test","worker":null,"payload":{"class":"EmailSenderShell","args":[["testShell"]],"id":"8a99e7bd37ffdf573a9e514dfe719571"}})","worker":"david-netbook:8846"} [] [2014-01-08 17:26:11] main.INFO: Processing ID:8a99e7bd37ffdf573a9e514dfe719571 in test {"type":"process","worker":"david-netbook:8846","job_id":"8a99e7bd37ffdf573a9e514dfe719571"} []
Can you try with CakeResque enqueue
command ?
cake CakeResque.CakeResque enqueue EmailSenderShell testShell
If it works correctly, try again with the --user
flag, and specify the user you php us running under.
this is the result:
sudo Console/cake CakeResque.CakeResque enqueue default
mailSenderShell "testShell"
Adding a job to worker
Succesfully enqueued Job #d8d678e48e7ac52481b4f415fb918ae3
Resque Statistics
---------------------------------------------------------------
Jobs Stats
Processed Jobs : 189
Failed Jobs : 189
Queues Stats
Queues count : 1
- default : 0 pending jobs
Workers Stats
Workers count : 2
REGULAR WORKERS
* david-netbook:2957:default
- Started on : jue ene 09 12:07:58 ART 2014
- Processed Jobs : 0
- Failed Jobs : 0
* david-netbook:2716:default
- Started on : Thu Jan 09 12:02:30 ART 2014
- Processed Jobs : 33
- Failed Jobs : 33
and I also tried with other functions to do simple things like:
$ this-> out ('Hello World');
And the resuls are the same
where goes the flag --user?
There should be 2 log files for resque, located in the tmp/logs
directory. The other log file should contains all php errors
in the log file I see this:
PHP Fatal error: Class 'AppShell' not found in /home/david/izus/dev/apps/gama-app/Console/Command/EmailSenderShell.php on line 6
Fatal error: Class 'AppShell' not found in /home/david/izus/dev/apps/gama-app/Console/Command/EmailSenderShell.php on line 6 [31;4mFatal Error Error:[0m Class 'AppShell' not found in [/home/david/izus/dev/apps/gama-app/Console/Command/EmailSenderShell.php, line 6]
this is a cap of my working tree
Add App::uses('AppShell', 'Console/Command');
to the start of your job classes
My job class:
<?php
# app/Console/Command/EmailSenderShell.php
App::uses('AppShell', 'Console/Command');
class EmailSenderShell extends AppShell
{
public function testShell() {
$this->out('Hello world.');
}
in the sell I run sudo Console/cake CakeResque.CakeResque clear all
and stop all queues, then I start a new queue and add a job
sudo Console/cake CakeResque.CakeResque enqueue default mailSenderShell "testShell"
Resque Statistics
---------------------------------------------------------------
Jobs Stats
Processed Jobs : 200
Failed Jobs : 200
Queues Stats
Queues count : 1
- default : 0 pending jobs
Workers Stats
Workers count : 1
REGULAR WORKERS
* david-netbook:5691:default
- Started on : jue ene 09 15:34:54 ART 2014
- Processed Jobs : 3
- Failed Jobs : 3
And what's the error log saying ?
Warning: fsockopen(): unable to connect to localhost:6379 (Conexión rehusada) in /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Redisent/Redisent.php on line 59 PHP Warning: fsockopen(): unable to connect to localhost:6379 (Conexión rehusada) in /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Redisent/Redisent.php on line 59
So there you have your error ... Redis server unavailable
this error happened accidentally, but I have redis up and running. went back to repeat the process and I obtain this to the redis database:
"resque:job:b83153de7d7a58ec03aea566f0a17e4a:status" 1389296374.191923 "SETEX" "failed:b83153de7d7a58ec03aea566f0a17e4a" "Resque_Exception\"error\"Could not find job class mailSenderShell.backtrace\"/home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Job.php(160): Resque_Job_Creator::createJob('mailSenderShell', Array)\ /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Job.php(191): Resque_Job->getInstance()\";i:2;s:135:\"#2 /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Worker.php(273): Resque_Job->perform()\";i:3;s:156:\"#3 /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/lib/Resque/Worker.php(236): Resque_Worker->perform(Object(Resque_Job))\";i:4;s:128:\"#4 /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/bin/resque(101): Resque_Worker->work('15')\";i:5;s:163:\"#5 /home/david/izus/dev/apps/gama-app/Plugin/CakeResque/vendor/kamisama/php-resque-ex/bin/resque(92): startWorker('test', 1, Object(MonologInit\MonologInit), '15') {main}
In your log:
Resque_Job_Creator::createJob('mailSenderShell', Array)
The job classname is mailSenderShell
instead of EmailSenderShell
Well, it worked. the problem seems to be redis settings. Now when I run TestShell above shows me no more error, but still does not create the text file, or if putting $ this-> out ('Hello World'), nor displays the message
And nothing in the log ?
no, the las error I got is Warning: fsockopen(): unable to connect to localhost:6379 (Conexión rehusada)
and the resque statics shows
* david-netbook:2548:test
- Started on : jue ene 09 16:34:03 ART 2014
- Processed Jobs : 21
- Failed Jobs : 6
So I assume it's working.
Reason why you don't see any message with $this->out()
is because all output is discarded, and not logged. Only errors are logged.
Using text file creation for test is not a good idea, as it's prone to permission issue. Are you sure the workers have the permission to create and write to the file ?
Thanks you, is working. The line $ this-> out ('Hello World'), write in the log file 'Hello world'. The problem was redis, do not implement the most appropriate solution, but it worked. what I did was reinstall redis as it was functioning bad
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:
And that also works. The problem is when I add a job to the queue for the worker to run them.
It returns the following: