# Path: webphamerator/app/celery_ext/celery_app.py
# def make_celery(app_name=__name__):
# 
# Path: webphamerator/app/auth.py
# AUTHENTICATION_NOT_NEEDED = ['/signin', '/db', '/static']
# def require_authentication():
# def is_authenticated():
# def is_password_required():
# def set_password(password):
# def delete_password():
# def sign_out():
# def authenticate(password):
# def is_password_valid(password):
# def digest(password, salt):
# def template_context():
# def show_sign_out_button():
# 
# Path: webphamerator/app/sqlalchemy_ext/models.py
# class Database(db.Model):
# class Job(db.Model):
# class JobOrganismToDelete(db.Model):
# class GenbankFile(db.Model):
# class Password(db.Model):
#     def url(self):
#     def mysql_name_for(cls, name):
#     def phamerator_name_for(cls, name):
#     def mysql_name(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):


from flask import (
        render_template, abort, request, url_for, redirect,
        send_from_directory, make_response, session, current_app, Blueprint)
from webphamerator.app.celery_ext.celery_app import celery
from webphamerator.app import auth
from webphamerator.app.sqlalchemy_ext import (db, models)
from pdm_utils import AlchemyHandler
import pham.db
import os
import io
    title = 'Jobs'
    if page != 1:
        title += ' (page {} of {})'.format(page, total_jobs / page_size + 1)

    view = render_template('jobs.html',
                           title=title,
                           jobs=jobs,
                           page=page,
                           next_page=next_page,
                           prev_page=prev_page,
                           navbar=get_navbar('/jobs', ignore_done=True))

    for job in jobs:
        if not job.seen:
            job.seen = True
    db.session.commit()

    return view


@bp.route('/jobs', methods=['POST'])
def cancel_all_jobs():
    if request.form.get('cancel-all') not in ['true', 'True']:
        return redirect(url_for('views.jobs'), code=303)

    celery.control.purge()
    # kill currently running tasks
    running_jobs = (db.session.query(models.Job)
                    .filter(models.Job.status_code == 'running').all())
    running_job_ids = [job.task_id for job in running_jobs]

# Path: webphamerator/app/celery_ext/celery_app.py
# def make_celery(app_name=__name__):
# 
# Path: webphamerator/app/auth.py
# AUTHENTICATION_NOT_NEEDED = ['/signin', '/db', '/static']
# def require_authentication():
# def is_authenticated():
# def is_password_required():
# def set_password(password):
# def delete_password():
# def sign_out():
# def authenticate(password):
# def is_password_valid(password):
# def digest(password, salt):
# def template_context():
# def show_sign_out_button():
# 
# Path: webphamerator/app/sqlalchemy_ext/models.py
# class Database(db.Model):
# class Job(db.Model):
# class JobOrganismToDelete(db.Model):
# class GenbankFile(db.Model):
# class Password(db.Model):
#     def url(self):
#     def mysql_name_for(cls, name):
#     def phamerator_name_for(cls, name):
#     def mysql_name(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):
#     def __repr__(self):


# Path: webphamerator/app/views.py
from flask import (
        render_template, abort, request, url_for, redirect,
        send_from_directory, make_response, session, current_app, Blueprint)
from webphamerator.app.celery_ext.celery_app import celery
from webphamerator.app import auth
from webphamerator.app.sqlalchemy_ext import (db, models)
from pdm_utils import AlchemyHandler
import pham.db
import os
import io

    title = 'Jobs'
    if page != 1:
        title += ' (page {} of {})'.format(page, total_jobs / page_size + 1)

    view = render_template('jobs.html',
                           title=title,
                           jobs=jobs,
                           page=page,
                           next_page=next_page,
                           prev_page=prev_page,
                           navbar=get_navbar('/jobs', ignore_done=True))

    for job in jobs:
        if not job.seen:
            job.seen = True
    db.session.commit()

    return view


@bp.route('/jobs', methods=['POST'])
def cancel_all_jobs():
    if request.form.get('cancel-all') not in ['true', 'True']:
        return redirect(url_for('views.jobs'), code=303)

    celery.control.purge()
    # kill currently running tasks
    running_jobs = (db.session.query(models.Job)
                    .filter(models.Job.status_code == 'running').all())
    running_job_ids = [job.task_id for job in running_jobs]

    celery.control.revoke(running_job_ids, terminate=True)