Code Monkey home page Code Monkey logo

Comments (18)

wa0x6e avatar wa0x6e commented on June 16, 2024

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 ?

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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"} []

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

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.

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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?

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

There should be 2 log files for resque, located in the tmp/logs directory. The other log file should contains all php errors

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

captura de pantalla de 2014-01-09 15 11 54

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

Add App::uses('AppShell', 'Console/Command'); to the start of your job classes

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

And what's the error log saying ?

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

So there you have your error ... Redis server unavailable

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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}

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

In your log:

Resque_Job_Creator::createJob('mailSenderShell', Array)

The job classname is mailSenderShell instead of EmailSenderShell

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

And nothing in the log ?

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

from cake-resque.

wa0x6e avatar wa0x6e commented on June 16, 2024

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 ?

from cake-resque.

DdCooper avatar DdCooper commented on June 16, 2024

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

from cake-resque.

Related Issues (20)

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.