def blog_publish_process(blog_id): user = auth.is_logged_in(request) blog = Blog.load(blog_id) permission = auth.is_blog_publisher(user, blog) control_jobs = Queue.control_jobs(blog) if control_jobs.count() > 0: queue_count = q_p(blog) # queue_count = transaction(queue.process_queue)(blog) time.sleep(RETRY_INTERVAL * 5) else: jobs = Queue.jobs(blog) if jobs.count() > 0: queue_count = jobs.count() Queue.start(blog, queue_count) queue_count = q_p(blog) # queue_count = transaction(queue.process_queue)(blog) time.sleep(RETRY_INTERVAL * 5) else: queue_count = 0 import settings return template('queue/queue_counter_include', blog=blog, settings=settings, queue_count=queue_count)
def blog_publish_progress(blog_id, original_queue_length): user = auth.is_logged_in(request) blog = Blog.load(blog_id) permission = auth.is_blog_publisher(user, blog) queue_count = 0 control_jobs = Queue.control_jobs(blog) if control_jobs.count() > 0: # queue_count = queue.process_queue(blog) # queue_count = transaction(queue.process_queue)(blog) queue_count = q_p(blog) time.sleep(RETRY_INTERVAL * 5) else: queue_count = 0 percentage_complete = int( (1 - (int(queue_count) / int(original_queue_length))) * 100) import settings return template('queue/queue_run_include', queue_count=queue_count, blog=blog, break_path='{}/blog/{}/publish/break'.format( BASE_URL, blog.id), settings=settings, percentage_complete=percentage_complete)
def blog_publish_process(blog_id): user = auth.is_logged_in(request) blog = Blog.load(blog_id) permission = auth.is_blog_publisher(user, blog) control_jobs = Queue.control_jobs(blog) if control_jobs.count() > 0: queue_count = q_p(blog) # queue_count = transaction(queue.process_queue)(blog) time.sleep(RETRY_INTERVAL * 5) else: jobs = Queue.jobs(blog) if jobs.count() > 0: queue_count = jobs.count() Queue.start(blog, queue_count) queue_count = q_p(blog) # queue_count = transaction(queue.process_queue)(blog) time.sleep(RETRY_INTERVAL * 5) else: queue_count = 0 import settings return template('queue/queue_counter_include', blog=blog, settings=settings, queue_count=queue_count)
def blog_publish_progress(blog_id, original_queue_length): user = auth.is_logged_in(request) blog = Blog.load(blog_id) permission = auth.is_blog_publisher(user, blog) queue_count = 0 control_jobs = Queue.control_jobs(blog) if control_jobs.count() > 0: # queue_count = queue.process_queue(blog) # queue_count = transaction(queue.process_queue)(blog) queue_count = q_p(blog) time.sleep(RETRY_INTERVAL * 5) else: queue_count = 0 percentage_complete = int((1 - (int(queue_count) / int(original_queue_length))) * 100) import settings return template('queue/queue_run_include', queue_count=queue_count, blog=blog, break_path='{}/blog/{}/publish/break'.format(BASE_URL, blog.id), settings=settings, percentage_complete=percentage_complete)
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)) p.status = page_status.published p.save(p.user, no_revision=True) queue_page_actions((p,)) blogs_to_check[p.blog.id] = p.blog
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)) p.status = page_status.published p.save(p.user, no_revision=True)