La documentazione di sedici indica che se più attività sono concatenate, il risultato della prima attività sarà il primo argomento del successivo. Il mio problema è che non riesco a farlo funzionare quando ho un'attività che restituisce più risultati.Celery: concatenamento di attività con più argomenti
Esempio:.
@task()
def get_comments(url):
#get the comments and the submission and return them as 2 objects
return comments, submission
@task
def render_template(threadComments, submission):
#render the objects into a html file
#does not return anything
Ora, se io li chiamo in una catena come (get_comments (URL) | render_template()) apply_asnc() Python getterà un TypeError: render_template() takes exactly 2 arguments (0 given)
.
Vedo che i risultati non vengono scartati e applicati agli argomenti. Se chiamo solo get_comments, posso fare:
result = get_comments(url)
arg1, arg2 = result
e ottenere entrambi i risultati.
Gli utenti interessati a una soluzione alla domanda "restituire gli argomenti posizionali per la prossima funzione" potrebbero essere interessati alla mia risposta http://stackoverflow.com/a/15778196/114917 –