0

我有一个这样的链:

 chain = file_transfer.s(password, source12, destination1) | save_db.s(request.user.id, basename, extension, servername, start_date1, datetime.datetime.utcnow().replace(tzinfo=utc)

在调用save_db.s时,我想调用以获取end_date这就是我用来datetime.datetime.utcnow().replace(tzinfo=utc)计算 end_date 的原因。问题是它计算任务启动的日期。如何获取每个任务的 end_date 并将 end_date 保存在数据库中以备后用。谢谢

4

1 回答 1

0

If you remember save_db.s will get result of file_transfer.s as first arg. Therefore you can return result from file_transfer.s as tuple with datetime.

Example:

from django.utils.timezone import now

def file_transfer(...):
    ...
    return (now(), ...)


def save_db(end_date, ...):
    ...
于 2013-07-03T06:36:05.340 回答