Example #1
0
def blog_break_queue(blog_id):
    user = auth.is_logged_in(request)
    blog = Blog.load(blog_id)
    permission = auth.is_blog_publisher(user, blog)

    Queue.stop(blog)

    tags = template_tags(blog=blog, user=user)

    return template(
        'queue/queue_run_ui',
        start=None,
        action_url='',
        start_message='''
<p>Queue publishing stopped. Note that queued items are still in the queue,
and may still be processed on the next queue run.</p>
<p><a href="{}/blog/{}/queue/clear"><button class="btn">Clear the queue</button></a> to remove them entirely.</p>
'''.format(BASE_URL, blog_id),
        title='Publishing queue progress',
        # search_context=(search_context['blog_queue'], blog),
        menu=generate_menu('blog_queue', blog),
        **tags.__dict__)
Example #2
0
def blog_break_queue(blog_id):
    user = auth.is_logged_in(request)
    blog = Blog.load(blog_id)
    permission = auth.is_blog_publisher(user, blog)

    Queue.stop(blog)

    tags = template_tags(blog=blog,
            user=user)

    return template('queue/queue_run_ui',
        start=None,
        action_url='',
        start_message='''
<p>Queue publishing stopped. Note that queued items are still in the queue,
and may still be processed on the next queue run.</p>
<p><a href="{}/blog/{}/queue/clear"><button class="btn">Clear the queue</button></a> to remove them entirely.</p>
'''.format(BASE_URL, blog_id),
        title='Publishing queue progress',
        # search_context=(search_context['blog_queue'], blog),
        menu=generate_menu('blog_queue', blog),
        **tags.__dict__)
Example #3
0
    if blogs_to_check:
        print ("Starting run.")
        from core.cms.queue import (queue_page_actions, queue_index_actions,
            queue_ssi_actions)
        from core.models import db
        from core.log import logger
        from time import sleep

        for b in blogs_to_check:
            try:
                n = blogs_to_check[b]
                skip = None

                if clear_job:
                    Queue.stop(n)

                if nowait is False and Queue.is_insert_active(n):
                    skip = 'Insert in progress for blog {}. Skipping this run.'.format(n.id)
                elif Queue.control_jobs(n).count() > 0:
                    skip = 'Job already running for blog {}. Skipping this run.'.format(n.id)
                if skip:
                    print (skip)
                    scheduled_page_report.append(skip)
                    continue

                for p in scheduled_pages.where(Page.blog == b).distinct():
                    scheduled_page_report.append('Scheduled pages:')
                    try:
                        with db.atomic() as txn:
                            scheduled_page_report.append('{} -- on {}'.format(p.title, p.publication_date))
Example #4
0
    if blogs_to_check:
        print("Starting run.")
        from core.cms.queue import (queue_page_actions, queue_index_actions,
                                    queue_ssi_actions)
        from core.models import db
        from core.log import logger
        from time import sleep

        for b in blogs_to_check:
            try:
                n = blogs_to_check[b]
                skip = None

                if clear_job:
                    Queue.stop(n)

                if nowait is False and Queue.is_insert_active(n):
                    skip = 'Insert in progress for blog {}. Skipping this run.'.format(
                        n.id)
                elif Queue.control_jobs(n).count() > 0:
                    skip = 'Job already running for blog {}. Skipping this run.'.format(
                        n.id)
                if skip:
                    print(skip)
                    scheduled_page_report.append(skip)
                    continue

                for p in scheduled_pages.where(Page.blog == b).distinct():
                    scheduled_page_report.append('Scheduled pages:')
                    try: