Exemplo n.º 1
0
def index():
    context = {'progress': manager.parser.get_help().split('\n')}
    if request.method == 'POST':
        parser = manager.parser.parse_args(request.form.get('options', ''))
        if manager.parser.error_msg:
            flash(escape(manager.parser.error_msg), 'error')
            context['options'] = request.form['options']
        else:
            executor.execute(parsed_options=parser, output=bufferqueue)
            context['execute_progress'] = True
            context['progress'] = progress(as_list=True)

    return render_template('execute/execute.html', **context)
Exemplo n.º 2
0
def execute(interval):
    """Adds a run to the executor"""

    # Make a list of feeds that run on this interval
    schedules = db_session.query(Schedule).filter(Schedule.interval == interval).all()
    feeds = set([sch.feed for sch in schedules])
    if u"__DEFAULT__" in feeds:
        feeds.remove(u"__DEFAULT__")
        # Get a list of all feeds that do not have their own schedule
        default_feeds = set(get_all_feeds()) - set(get_scheduled_feeds())
        feeds.update(default_feeds)

    if not feeds:
        # No feeds scheduled to run at this interval, stop the timer
        stop_timer(interval)
        return

    log.info("Executing feeds: %s" % ", ".join(feeds))
    fire_event("scheduler.execute")
    executor.execute(feeds=feeds)
Exemplo n.º 3
0
def execute(interval):
    """Adds a run to the executor"""

    # Make a list of tasks that run on this interval
    schedules = db_session.query(Schedule).filter(Schedule.interval == interval).all()
    tasks = set([sch.task for sch in schedules])
    if u'__DEFAULT__' in tasks:
        tasks.remove(u'__DEFAULT__')
        # Get a list of all tasks that do not have their own schedule
        default_tasks = set(get_all_tasks()) - set(get_scheduled_tasks())
        tasks.update(default_tasks)

    if not tasks:
        # No tasks scheduled to run at this interval, stop the timer
        stop_timer(interval)
        return

    log.info('Executing tasks: %s' % ", ".join(tasks))
    fire_event('scheduler.execute')
    executor.execute(tasks=tasks)
Exemplo n.º 4
0
def do_inject():
    fields = {}
    # Requests is a special dict, and cannot be passed as keyword arguments, make it into a normal dict.
    for key, value in request.values.iteritems():
        # Translate on and off to True and False
        if value == 'on':
            fields[key] = True
        elif value == 'off':
            fields[key] = False
        else:
            fields[key] = value
    # If we only got a url, make a title from the url filename
    fields['title'] = fields.get('title') or posixpath.basename(urlparse.urlsplit(fields.get('url', '')).path)

    if fields.get('title') and fields.get('url'):
        # Create the entry for injection
        entry = Entry(**fields)
        executor.execute(options={'dump_entries': True}, entries=[entry])
        flash('Scheduled execution for entry `%s`' % entry['title'], 'success')
    else:
        flash('Title and URL required for inject.', 'error')

    return redirect(url_for('index'))
Exemplo n.º 5
0
def inject(id):
    options = {'archive_inject_id': id, 'archive_inject_immortal': True}
    executor.execute(options=options)
    flash('Queued execution, see log for results', 'info')
    return render_template('archive/archive.html')
Exemplo n.º 6
0
def inject(id):
    options = {'archive_inject_id': id, 'archive_inject_immortal': True}
    executor.execute(options=options)
    flash('Queued execution, see log for results', 'info')
    return render_template('archive/archive.html')