コード例 #1
0
def update_manifests(ids, **kw):
    retry_secs = 3600
    task_log.info('[%s@%s] Update manifests.' %
                  (len(ids), update_manifests.rate_limit))
    check_hash = kw.pop('check_hash', True)
    retries = kw.pop('retries', {})
    # Since we'll be logging the updated manifest change to the users log,
    # we'll need to log in as user.
    mkt.set_user(get_task_user())

    for id in ids:
        _update_manifest(id, check_hash, retries)
    if retries:
        try:
            update_manifests.retry(args=(retries.keys(), ),
                                   kwargs={
                                       'check_hash': check_hash,
                                       'retries': retries
                                   },
                                   eta=datetime.datetime.now() +
                                   datetime.timedelta(seconds=retry_secs),
                                   max_retries=5)
        except RetryTaskError:
            _log(id, 'Retrying task in %d seconds.' % retry_secs)

    return retries
コード例 #2
0
 def wrapper(*args, **kw):
     old_user = get_user()
     set_user(get_task_user())
     try:
         result = f(*args, **kw)
     finally:
         set_user(old_user)
     return result
コード例 #3
0
ファイル: decorators.py プロジェクト: anushbmx/zamboni
 def wrapper(*args, **kw):
     old_user = get_user()
     set_user(get_task_user())
     try:
         result = f(*args, **kw)
     finally:
         set_user(old_user)
     return result
コード例 #4
0
ファイル: tasks.py プロジェクト: rctgamer3/zamboni
def update_manifests(ids, **kw):
    retry_secs = 3600
    task_log.info("[%s@%s] Update manifests." % (len(ids), update_manifests.rate_limit))
    check_hash = kw.pop("check_hash", True)
    retries = kw.pop("retries", {})
    # Since we'll be logging the updated manifest change to the users log,
    # we'll need to log in as user.
    amo.set_user(get_task_user())

    for id in ids:
        _update_manifest(id, check_hash, retries)
    if retries:
        try:
            update_manifests.retry(
                args=(retries.keys(),),
                kwargs={"check_hash": check_hash, "retries": retries},
                eta=datetime.datetime.now() + datetime.timedelta(seconds=retry_secs),
                max_retries=5,
            )
        except RetryTaskError:
            _log(id, "Retrying task in %d seconds." % retry_secs)

    return retries