示例#1
0
    def __init__(self,
                 desc=None,
                 prog=sys.argv[0],
                 usage=None,
                 add_help=True,
                 argument_default=None,
                 prefix_chars="-",
                 toplevel=False) -> None:

        super().__init__(description=desc,
                         prog=prog,
                         usage=usage,
                         add_help=add_help,
                         argument_default=argument_default,
                         prefix_chars=prefix_chars,
                         formatter_class=FafHelpFormatter)

        self.add_argument("-v",
                          "--verbose",
                          action="store_const",
                          const=logging.DEBUG,
                          default=logging.INFO,
                          help="turn on all verbose output except for SQL")
        self.add_argument("--sql-verbose",
                          action="store_true",
                          default=False,
                          help="show all SQL queries (really verbose)")
        self.add_argument("-d",
                          "--debug",
                          action="store_true",
                          default=False,
                          help="show full traceback for unhandled exceptions")
        self.add_argument("--dry-run",
                          action="store_true",
                          default=False,
                          help="do not flush any changes to the database")

        if toplevel:
            action_parsers = self.add_subparsers(title="action")
            for action_name, action_object in actions.items():
                action_parser = action_parsers.add_parser(action_name)
                action_object.tweak_cmdline_parser(action_parser)
                action_parser.set_defaults(func=action_object.run)
示例#2
0
from pyfaf.problemtypes import problemtypes
from pyfaf.opsys import systems
from pyfaf.bugtrackers import bugtrackers
from pyfaf.solutionfinders import solution_finders

from webfaf.forms import TagListField
from webfaf.utils import Pagination, admin_required
from webfaf.webfaf_main import db  # pylint: disable=wrong-import-order

url_prefix = "/celery_tasks"

celery_tasks = Blueprint("celery_tasks", __name__)

# Filter actions to exclude cmdline_only ones
actions = dict()
for n, a in actions_all.items():
    if not a.cmdline_only:
        actions[n] = a


@celery_tasks.route("/")
@admin_required
def index() -> str:
    inspect = celery_app.control.inspect()
    pts = db.session.query(PeriodicTask).order_by(PeriodicTask.id).all()
    trs = (db.session.query(TaskResult).order_by(
        TaskResult.finished_time.desc()).limit(20).all())
    return render_template("celery_tasks/index.html",
                           periodic_tasks=pts,
                           task_results=trs,
                           inspect_active=inspect.active() or {},
示例#3
0
文件: celery_tasks.py 项目: sorki/faf
    SelectField,
    FileField,
    BooleanField,
    TextAreaField,
    ValidationError,
)

from webfaf2.forms import TagListField
from webfaf2.utils import Pagination, admin_required

url_prefix = "/celery_tasks"

celery_tasks = Blueprint("celery_tasks", __name__)

# Filter actions to exclude cmdline_only ones
actions = {n: a for (n, a) in actions_all.items() if not a.cmdline_only}


@celery_tasks.route("/")
@admin_required
def index():
    inspect = celery_app.control.inspect()
    pts = db.session.query(PeriodicTask).order_by(PeriodicTask.id).all()
    trs = db.session.query(TaskResult).order_by(TaskResult.finished_time.desc()).limit(20).all()
    return render_template(
        "celery_tasks/index.html",
        periodic_tasks=pts,
        task_results=trs,
        inspect_active=inspect.active() or {},
        inspect_scheduled=inspect.scheduled() or {},
        actions=sorted(actions.keys()),
示例#4
0
文件: celery_tasks.py 项目: abrt/faf
from pyfaf.problemtypes import problemtypes
from pyfaf.opsys import systems
from pyfaf.bugtrackers import bugtrackers
from pyfaf.solutionfinders import solution_finders

from webfaf_main import db
from webfaf.forms import TagListField
from webfaf.utils import Pagination, admin_required

url_prefix = "/celery_tasks"

celery_tasks = Blueprint("celery_tasks", __name__)

# Filter actions to exclude cmdline_only ones
actions = dict()
for n, a in actions_all.items():
    if not a.cmdline_only:
        actions[n] = a


@celery_tasks.route("/")
@admin_required
def index():
    inspect = celery_app.control.inspect()
    pts = db.session.query(PeriodicTask).order_by(PeriodicTask.id).all()
    trs = (db.session.query(TaskResult)
           .order_by(TaskResult.finished_time.desc())
           .limit(20).all())
    return render_template("celery_tasks/index.html",
                           periodic_tasks=pts,
                           task_results=trs,
示例#5
0
from pyfaf.bugtrackers import bugtrackers
from pyfaf.solutionfinders import solution_finders

from wtforms import (Form, IntegerField, validators, SelectMultipleField,
                     TextField, SelectField, FileField, BooleanField,
                     TextAreaField, ValidationError)

from webfaf2.forms import TagListField
from webfaf2.utils import Pagination, admin_required

url_prefix = "/celery_tasks"

celery_tasks = Blueprint("celery_tasks", __name__)

# Filter actions to exclude cmdline_only ones
actions = {n: a for (n, a) in actions_all.items() if not a.cmdline_only}


@celery_tasks.route("/")
@admin_required
def index():
    inspect = celery_app.control.inspect()
    pts = db.session.query(PeriodicTask).order_by(PeriodicTask.id).all()
    trs = (db.session.query(TaskResult).order_by(
        TaskResult.finished_time.desc()).limit(20).all())
    return render_template("celery_tasks/index.html",
                           periodic_tasks=pts,
                           task_results=trs,
                           inspect_active=inspect.active() or {},
                           inspect_scheduled=inspect.scheduled() or {},
                           actions=sorted(actions.keys()))