コード例 #1
0
def rq_stats():
    queue = get_queue()
    failed_queue = get_failed_queue()
    try:
        workers = Worker.all(queue.connection)
    except ConnectionError:
        return None

    num_workers = len(workers)
    is_running = len(queue.connection.smembers(Worker.redis_workers_keys)) > 0
    if is_running:
        # Translators: this refers to the status of the background job worker
        status_msg = ungettext('Running (%d worker)', 'Running (%d workers)',
                               num_workers) % num_workers
    else:
        # Translators: this refers to the status of the background job worker
        status_msg = _('Stopped')

    result = {
        'job_count': queue.count,
        'failed_job_count': failed_queue.count,
        'is_running': is_running,
        'status_msg': status_msg,
    }

    return result
コード例 #2
0
ファイル: dashboard.py プロジェクト: phlax/pootle
def rq_stats():
    queue = get_queue()
    failed_queue = get_failed_queue()
    try:
        workers = Worker.all(queue.connection)
    except ConnectionError:
        return None

    num_workers = len(workers)
    is_running = len(queue.connection.smembers(Worker.redis_workers_keys)) > 0
    if is_running:
        # Translators: this refers to the status of the background job worker
        status_msg = ungettext('Running (%d worker)', 'Running (%d workers)',
                               num_workers) % num_workers
    else:
        # Translators: this refers to the status of the background job worker
        status_msg = _('Stopped')

    result = {
        'job_count': queue.count,
        'failed_job_count': failed_queue.count,
        'is_running': is_running,
        'status_msg': status_msg,
    }

    return result
コード例 #3
0
    def handle_noargs(self, **options):
        # The script prefix needs to be set here because the generated URLs
        # need to be aware of that and they are cached. Ideally Django should
        # take care of setting this up, but it doesn't yet (fixed in Django
        # 1.10): https://code.djangoproject.com/ticket/16734
        script_name = (u'/' if settings.FORCE_SCRIPT_NAME is None else
                       force_unicode(settings.FORCE_SCRIPT_NAME))
        set_script_prefix(script_name)

        failed_queue = get_failed_queue()
        for job_id in failed_queue.get_job_ids():
            failed_queue.requeue(job_id=job_id)
コード例 #4
0
ファイル: retry_failed_jobs.py プロジェクト: Jobava/pootle
    def handle_noargs(self, **options):
        # The script prefix needs to be set here because the generated
        # URLs need to be aware of that and they are cached. Ideally
        # Django should take care of setting this up, but it doesn't yet:
        # https://code.djangoproject.com/ticket/16734
        script_name = (u'/' if settings.FORCE_SCRIPT_NAME is None
                            else force_unicode(settings.FORCE_SCRIPT_NAME))
        set_script_prefix(script_name)

        failed_queue = get_failed_queue()
        for job_id in failed_queue.get_job_ids():
            failed_queue.requeue(job_id=job_id)
コード例 #5
0
ファイル: dashboard.py プロジェクト: bluemutedwisdom/pootle
def rq_stats():
    queue = get_queue()
    failed_queue = get_failed_queue()
    workers = Worker.all(queue.connection)
    is_running = False
    if len(workers) == 1:
        is_running = not workers[0].stopped

    result = {
        'job_count': queue.count,
        'failed_job_count': failed_queue.count,
        'is_running': is_running,
    }

    return result
コード例 #6
0
ファイル: dashboard.py プロジェクト: bluemutedwisdom/pootle
def rq_stats():
    queue = get_queue()
    failed_queue = get_failed_queue()
    workers = Worker.all(queue.connection)
    is_running = False
    if len(workers) == 1:
        is_running = not workers[0].stopped

    result = {
        'job_count': queue.count,
        'failed_job_count': failed_queue.count,
        'is_running': is_running,
    }

    return result
コード例 #7
0
ファイル: retry_failed_jobs.py プロジェクト: yiyibooks/pootle
 def handle(self, **options):
     failed_queue = get_failed_queue()
     for job_id in failed_queue.get_job_ids():
         failed_queue.requeue(job_id=job_id)