2012-11-27 5 views
8

Sto provando a distribuire un semplice esempio di sedano nel mio server di produzione, ho seguito il tutorial nel sito Web di sedici sull'esecuzione di sedano come demone http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#daemonizing , e ho avuto il file di configurazione in /etc/default/celeryddjango/sedano - stato di sedano: Errore: nessun nodo ha risposto entro il limite di tempo

 
    1 # Name of nodes to start 
    2 # here we have a single node 
    3 CELERYD_NODES="w1" 
    4 # or we could have three nodes: 
    5 #CELERYD_NODES="w1 w2 w3" 
    6 
    7 # Where to chdir at start. 
    8 CELERYD_CHDIR="/home/audiwime/cidec_sw" 
    9 
10 # Python interpreter from environment. 
11 ENV_PYTHON="/usr/bin/python26" 
12 
13 # How to call "manage.py celeryd_multi" 
14 CELERYD_MULTI="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryd_multi" 
15 
16 # # How to call "manage.py celeryctl" 
17 CELERYCTL="$ENV_PYTHON $CELERYD_CHDIR/manage.py celeryctl" 
18 
19 # Extra arguments to celeryd 
20 CELERYD_OPTS="--time-limit=300 --concurrency=8" 
21 
22 # Name of the celery config module. 
23 CELERY_CONFIG_MODULE="celeryconfig" 
24 
25 # %n will be replaced with the nodename. 
26 CELERYD_LOG_FILE="/var/log/celery/%n.log" 
27 CELERYD_PID_FILE="/var/run/celery/%n.pid" 
28 
29 # Workers should run as an unprivileged user. 
30 CELERYD_USER="audiwime" 
31 CELERYD_GROUP="audiwime" 
32 
33 export DJANGO_SETTINGS_MODULE="cidec_sw.settings" 

ma se corro

celery status

nel terminale, ho ottenuto questa risposta:

012.351.
Error: No nodes replied within time constraint

posso riavviare il sedano tramite lo script celeryd previsto https://github.com/celery/celery/tree/3.0/extra/generic-init.d/

 
/etc/init.d/celeryd restart 
celeryd-multi v3.0.12 (Chiastic Slide) 
> w1.one.cloudwime.com: DOWN 
> Restarting node w1.one.cloudwime.com: OK 

posso correre

python26 manage.py celeryd -l info

e le mie attività in Django funzionano bene, ma se lascio il demone fare il suo lavoro non ottengo alcun risultato, non ho nemmeno errori in /var/log/celery/w1.log

So che il mio compito è stato registrato perché ho fatto questo

from celery import current_app 
def call_celery_delay(request): 
    print current_app.tasks 
    run.delay(request.GET['age']) 
    return HttpResponse(content="celery task set",content_type="text/html") 

ed ottengo un dizionario in wich mio compito appare

{'celery.chain': <@task: celery.chain>, 'celery.chunks': <@task: celery.chunks>, 'celery.chord': <@task: celery.chord>, 'tasks.add2': <@task: tasks.add2>, 'celery.chord_unlock': <@task: celery.chord_unlock>, **'tareas.tasks.run': <@task: tareas.tasks.run>**, 'tareas.tasks.add': <@task: tareas.tasks.add>, 'tareas.tasks.test_two_minute': <@task: tareas.tasks.test_two_minute>, 'celery.backend_cleanup': <@task: celery.backend_cleanup>, 'celery.map': <@task: celery.map>, 'celery.group': <@task: celery.group>, 'tareas.tasks.test_one_minute': <@task: tareas.tasks.test_one_minute>, 'celery.starmap': <@task: celery.starmap>} 

ma oltre a questo io ottenere nient'altro, nessun risultato dal mio compito, nessun errore in i registri, niente. Qualcuno può dirmi cosa può essere sbagliato? Tu sei la mia unica speranza ...

risposta

-1

ho risolto il mio problema, è stata una soluzione molto semplice, ma era anche uno strano: Quello che ho fatto è stata:

$ /etc/init.d/celerybeat restart 
$ /etc/init.d/celeryd restart 
$ service celeryd restart 

che dovevo fare questo in quell'ordine, altrimenti otterrei un brutto errore: nessun nodo ha risposto entro limiti di tempo.

+0

Non penso che sia necessario 'celerybeat' e' celeryd'. Puoi eseguire 'celeryd -B', che è lo stesso. Sono ancora abbastanza curioso di come hai ottenuto un 'servizio celeryd' :) (P.S.Ho ancora ricevuto questo errore) – Houman

+1

@kave questo errore arriva principalmente quando tutti i permessi dei file non sono corretti –

+0

@AkashDeshpande Grazie per la risposta. Che tu possa essere così gentile e dare un'occhiata a questa pasta: http://pastebin.com/e3GK4eax Ecco come ho impostato i permessi, vedi qualcosa di ovvio fuori uso? – Houman

1

Utilizzare il seguente comando per trovare il problema:

C_FAKEFORK=1 sh -x /etc/init.d/celeryd start 

Questo di solito accade perché ci sono problemi nel vostro progetto sorgente (problemi di autorizzazione, errore di sintassi, ecc)

Come menzionato nei documenti di sedano: -

If the worker starts with “OK” but exits almost immediately afterwards and there is nothing in the log file, then there is probably an error but as the daemons standard outputs are already closed you’ll not be able to see them anywhere. For this situation you can use the C_FAKEFORK environment variable to skip the daemonization step

Good Luck

Fonte: Celery Docs

0

perché il daemon di sedano potrebbe non essere avviato. Questa è una delle ragioni. Quindi ricominciamo gentilmente usando python manage.py celeryd --loglevel = INFO